|
How to plot into graph from Array data using ASP.NET |
Posted by Bill Cantor on Nov-26-2011 09:10 |
|
How to plot the array data below into graph? From the example is hard coded value. I want
it to plot value from array data. TIA
double[, ,] GraphData;
GraphData = new double[7, 20]; //where 7, number of columns, maximum of 20 rows
for (int i = 0; i < NumRows; i++)
{
GraphData[1,i] = double.Parse(PerDayArray[1, i]);
GraphData[2,i] = double.Parse(PerDayArray[2, i]);
GraphData[3,i] = double.Parse(PerDayArray[3, i]);
GraphData[4,i] = double.Parse(PerDayArray[4, i]);
GraphData[5,i] = double.Parse(PerDayArray[5, i]);
GraphData[6,i] = double.Parse(PerDayArray[6, i]);
GraphData[7,i] = double.Parse(PerDayArray[7, i]);
} |
Re: How to plot into graph from Array data using ASP.NET |
Posted by Peter Kwan on Nov-28-2011 18:34 |
|
Hi Bill,
You may simply copy the data to a single dimension array and them pass them to ChartDirector.
For example:
double[] myData = new double[NumRows];
for (int i = 0; i < GraphData.GetLength(0); ++i)
{
//copy to single dimension array
for (int j = 0; j < NumRows; ++j)
myData[j] = GraphData[i, j];
//pass to ChartDirector
c.addLineLayer(myData, -1, "My Line " + i);
}
(Note: I see that in your code, you use 1, 2, 3, 4, 5, 6, 7 as the array index. I believe they should be 0, 1, 2, 3, 4, 5, 6.)
Hope this can help.
Regards
Peter Kwan |
Re: How to plot into graph from Array data using ASP.NET |
Posted by Bill Cantor on Nov-28-2011 20:21 |
|
Thanks Peter |
|