draw graph with mschart by splting data

hi all.i am working on a project which is for drawing a graph with data that are comming from n instrument that measures decible of the place. i want to store the measurements in my database bue the question is here: my database has just two columns.one is PK and its name is graphid and is for setting the number of the graph,ex :graph number one has graphid=1 and so on.so when for every test(one graphid) i want to store the decibles in another column with "decible" name.but i want to store decible measures like this: 12,45,56,67,...i mean i want to store them in just one column and seperate it with comma..please jelp me how i can store the data like this and how to read it? i know  string.split but i do not know how to use it and how to assign it to my Yvauenumber of my chart. plereease help me.i am in trouble.

thanks

0
narina
5/3/2009 7:34:16 AM
asp.net.drawinggdi 1803 articles. 0 followers. Follow

15 Replies
863 Views

Similar Articles

[PageSpeed] 31

 ok

u can do in this way 

first stored ur value in one strin say s1

then create string array s2 

say 

dim s2 as string[]=s1.split( ',' )

now use for loop to attach this values to graph in this way

for i =0 to s2.length

chart.Data.Add(New WebChart.ChartPoint( i+1&"position value", s2[i]))

next

0
Deeno20
5/3/2009 1:44:56 PM

ity is in vb  i am a c# programmer ,i tried to convert it, but something is wrong,there is no chart.data.add.......  i could not  figure it out,could you please help me in c#.thanks

0
narina
5/3/2009 4:00:15 PM

string strValue ="12,45,56,67";

string[] arrStr = strValue.Split(',');

for(int i = 0;i <=arrStr.Length; i++)
{
      myChart.Data.Add(new WebChart.ChartPoint(i.ToString(), arrStr[i]))
}

Refer below links to know more:

http://www.carlosag.net/Tools/WebChart/sampleCode.aspx

http://www.carlosag.net/Tools/WebChart/imagelinemarker.aspx


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/3/2009 4:12:21 PM

i anm working on windows application and the webchart is webchart and it errors me to missing namespaces.also i am using mschart control,couldn1t i assign the arraylist(arrStr) to my mschart control?help me how.i tried this code:

chart1.Series["Series1"].YValueMembers = "arrStr" but it does not help and show me aan empty chart.help pleeeeeeeeease.

0
narina
5/3/2009 5:23:44 PM

Try this;

string strValue ="12,45,56,67";

string[] arrStr = strValue.Split(',');

for(int i = 0;i <=arrStr.Length; i++)
{
      chart1.Series["Series1"].YValueMembers = arrStr[i];

 


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/3/2009 5:41:08 PM

 have u add Chart.dll file in ur toolbox ......

add it first and then drop down that controll in ur design view ,it will work 

and code for the c# is below

string s1;

string [] s2=s1.split( ' , ' ) ;

for (int i=0; i< s1.length ;i++)

{

  chart.Data.Add(New WebChart.ChartPoint(i.tostring+"Posion",s2[i]));
  }

i hop this will help you

0
Deeno20
5/4/2009 5:09:48 AM

hi.i tried it but it error me this at the last line: Index was outside the bounds of the array.

is anyone test it before?i really confused what should i do

0
narina
5/4/2009 5:49:31 AM

 My mistake, i have corrected it and marked it as bold

string strValue ="12,45,56,67";

string[] arrStr = strValue.Split(',');

for(int i = 0;i <=arrStr.Length - 1; i++)
{
      chart1.Series["Series1"].YValueMembers = arrStr[i];

}

 


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/4/2009 5:53:17 AM

i test it again but it show me a blank white  chart without axis and anything,i think there is something missing.i have to say that this code is working for a double array:

double [] array = { 2.8, 4.4, 6.5, 8.3, 3.6, 5.6, 7.3, 9.2, 1.0};
 
// Bind the double array to the Y axis points of the data series.
Chart1.Series["Series1"].Points.DataBindY(array);

 but about my daa that is string and coming from database i don`t know.!!!!!!!!!!!!!!!!
0
narina
5/4/2009 6:43:03 AM

 If double is working, loop throug string and converting the data in double.


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/4/2009 7:07:41 AM

 make it S2.length-1 in for loop

0
Deeno20
5/4/2009 8:06:19 AM

what do you mean of s2.Lenght-1  ?what is s2? if you mean my array , i have done it like this :

for(i=0;i<=arrstr.Lenght-1;i++)

but it shows me an empty chart.i do not know what to do more? 

0
narina
5/4/2009 9:24:56 AM

  i just want to know that ur using asp.net2.0 or 3.5

 next if ur using asp.net2.0 then u have to add chartcontoll.dll file ok 

 if ur using asp.net 2.0 give ur email id will mail u the  Graphcontroll.dll that i have

and for 3.5 i m sorry i m still using asp.net 2.0

THIS IS tested Code and Giving me the graph

protected void Page_Load(object sender, EventArgs e)
    {
        string s1 = "12,10,13,20,100";
        string[] ss = s1.Split(',');
        WebChart.ColumnChart chart=new WebChart.ColumnChart() ;
        for (int i = 0; i < ss.Length - 1; i++)
        {
            float f_num = float.Parse(ss[i]);

            chart.Data.Add(new WebChart.ChartPoint(Convert.ToString(i), f_num));
          
        }
        
            ChartControl1.Charts.Add(chart);
            ChartControl1.RedrawChart();
    }
0
Deeno20
5/4/2009 10:07:14 AM

hi and thank you all.i solved my problem with this:

string st ="12,45,56,67"; // comes from database

string [] arrString = st.Split(new char[] {','});

double[] arrDouble = new double[arrString.Length];for(int i=0; i<arrString.Length; i++)

{

arrDouble[i] =
double.Parse(arrString[i]);

}

chart1.Series["Series1"].Points.DataBindY(arrDouble);

chart1.Series["Series1"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;

 it draw a line chart for me.thank you all for your help and time.

0
narina
5/4/2009 11:11:03 AM

 Hi narina,

Please mark the post as answer which helped you in resolving the issue, so that other can refer for same kind of issue.


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/4/2009 12:00:16 PM
Reply:

Similar Artilces:

Drawing data values in a line graph
Hello I need to draw the number of the value that is drawn on a datawindow graph line. It is posible? I'll email a simple PBL that labels a value on a graph. It uses textboxes to do it. Santiago wrote: > Hello > > I need to draw the number of the value that is drawn on a datawindow graph > line. > > It is posible? ...

.NET 2.0 Data Connection (.NET 2.0 Beta Data Provider)
I have installed the .NET 2.0 Beta Data Provider, in the server explorer in Visual Studio 2005 I have tried to connect to this provider but I can not see it in the list. Is there something else you need to do to see this other than what is in the instructions or is this not supported yet? Hi Dean, I assume you mean ASE ADO.NET 2.0 Beta. I'm attaching the html readme for this product that you should have from downloading it. Are you talking about using Server Explorer to see the Provider? This functionality isn't working yet and should be available on GA or shortly ...

data, data, data
Hello, I need some advice on the best method to keep a database updated in this scenario. I have a local Solomon SQL Server where we keep our inventory. I want to build an application that will be hosted at a remote hosting location which provides a SQL database. I want to build the application to allow clients to access the inventory items and make requests based on the remote SQL data. The order will be sent to our fulfillment department via email; they will fiill the request and ship.  I'm not sure the method to do this while keeping the data current on the remote and the l...

which is shou i use? Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NET
Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NETI am confused?Which is better or which one should I use?BTW, I am going to use .net 2.0 with oracle 9. Can anyone tell me what shou I use for working with oracle database?Thanks very much in advance!Justin Oracle's data provider has more functionality than Microsoft's.If your doing transaction processing you can have SAVEPOINTs, which Microsoft's data provider does not provide.Also, Oracle has PL/SQL Associative Arrays which are very powerful.Oracle also allows you to bind parameters by name and pos...

exporting datagrid data from C#...need to drawing Excel graphs
Read the available online help, FAQ postings, even Googled this question.  No clear or obvious answer. I'm going to try and use Excel's graphing capabilities to display the datagrid info in a separate window. In my C# code, I need to know what to pass to the Excel object to display a bar graph or a pie chart.    They want pretty pictures now.  Definitely not sure if I'm following the right path here. HELP! Check out these links http://articles.techrepublic.com.com/5100-3513_11-5888409.html http://www.spreadsheetgear.com/support/samples/charting.as...

Dynamic Data over ADO.NET Data Service
I would like to create a dynamic data web site that does not have a database connection to the underlying database, but instead accesses the data through an ADO.NET data service.  Is this possible?  Thanks,Dennis If you look at the Dynamic Data Futures solution on CodePlex, it has an early version of something that does that.  Also, see this thread. thanks,David David,  That's exactly what I was looking for.  However, I am running into a problem when I try to develop my own dynamic data client site.  I created a dynamic data web site, added a referenc...

GPF when printing definition of graph or data in the graph
I have 3 graph type datawindows that have always worked (That I'm aware of.). I just had to redesign a portion of them and now when I try to print the graph whether it be the definition or with data in it, it gets a GPF. So, I went back to my saved version of the graphs that I backed-up. They now do the same thing. I haven't tried to work with the graphs since we converted to 32-bit in February. Is there something different about the graph datawindow in the 32-bit environment or is there a bug? Any suggestions or answers would truly be appreciated. Thanks for you help...

Dynamic Data with ADO.NET Data Services
Is it currently possible to use Dynamic Data with ADO.NET Data Services? I've had a play with this to see if this would work but I didnt have much luck. I ran the datasvcutil.exe against my service (which is a  ADO.NET Data Services on a LINQ to SQL model) but I ended up with a "The context type 'Entities.NorthwindDataContext' is not supported" message.  It seems to make sense that these technologies would work together...is there something else I am missing? Perhaps this functionality isn't supported yet? Thanks, Craig Hi Cr...

Dynamic Data And Ado.Net Data Service
Hi,I'm wondering if it is possible to mix up Dynamic Data and Ado.Net Data Service.I have found no information on google yet.Thanks for your replies, Hasan Yes you will be able to have a look at the Preview on Codeplext here the new Domain Service will allow this sort of thing see David Ebbo's and Nukhil Kothari's sessions at mix09 Microsoft ASP.NET 4.0 Data Access: Patterns for Success with Web Forms .NET RIA Services - Building Data-Driven Applications with Microsoft Silverlight and Microsoft ASP.NETSteve Seeking the elegant solution.[Oh! If olny I colud tpye!]c# Bits...

The .Net Data SQL Provider (System.Data.SqlClient) requires Microsoft Data Access Components(MDAC) version 2.6 or later.
I am getting error like The .Net Data SQL Provider (System.Data.SqlClient) requires Microsoft Data Access Components(MDAC) version 2.6 or later. i am working with windowsXP. Already in my system i have MDAC 2.7. I donot know why am i getting error like this. anybody help me please...

Dynamic Data with ADO.NET Data Services #2
I'm using the DynamicData Futures Preview 2 DLL's to create an n-tier Dynamic Data website using ADO.Net Data Services.I'm trying to add Many-to-Many relationship support using David Ebbo's article as a basis, but it would appear that the client-side model generated by DataSvcUtil.exe (Add Service Reference....) doesn't contain enough information to identify Many-to-Many relationships?For example, I have Contacts and Regions joined through a ContactRegion table.  EF models this correctly on the server and DataServices exposes it correctly - With a Contact having a Re...

Dynamic Data working against an ADO.NET Data Service
 Is there an example available of Dynamic Data using an ADO.NET Data Service?  I read there are prototypes of this in the works, are they available for review / use?  Check out our Dynamic Data Futures for a prototype data source control for consuming ADO.NET Data Services. http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14475.Scott HunterPM, ASP.NET Team, Microsoft...

Can graph data points be shown inside graph?
Hello Using a graph within a datawindow (example: revenue by month). Is it possible to display the actual revenue number (data point) above the column for each month? Right now I'm using MajorGridLines and specify the number of MajorDivisions, which help to visually trace back to the value axis. Other suggestions? Thanks, Michael This is a multi-part message in MIME format. ---=_forums-2-dub42150b6a Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit not that I'm aware of. but here is my work around. create a user event in a...

drawing in .NET
i am trying to generate images on the fly, when composing the image, the graphics get blurred as i add text over the existing graphics, or add things to the graphics is there any way to get around this, and jsut draw without extra rendering? GO HOKIES!!! Have you tried using the PNG format? I get better results streaming as a PNG vs a JPEG.Justin...

Web resources about - draw graph with mschart by splting data - asp.net.drawinggdi

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Fear and Loathing - Contents tagged with CodePlex - Tags
When last we met the Swine Trek, that scientific genius Dr. Strangepork was trying to fix Captain Link Hearthrobs lighter. Oh wait, wrong show. ...

[...] The Morning Brew #247 (Chris Alcock) [...]
A daily link blog covering all aspects of the Microsoft Development World, published every working week day

Latest Updates
Latest Updates - Free source code and tutorials for Software developers and Architects.; Updated: 15 Feb 2013

Latest Updates
Latest Updates - Free source code and tutorials for Software developers and Architects.; Updated: 15 Feb 2013

Resources last updated: 11/27/2015 5:43:51 PM