kingy0489
asked on
Using DateTime with the ASP.net/C# Chart Control
Hi,
I am having trouble with DateTimes in ASP.net Charting control. I want a graph with time across the bottom and then values as the Y values.
I have stubbed a program below for you to see where I am so far, the problem being the graph only uses the Date and not the Time also. This is obviously not very useful to me, as I end up with the same Date written along the XAxis and no way to see the time.
I have looked around for the answer to this and can't find it anywhere, so any help appreciated.
I am having trouble with DateTimes in ASP.net Charting control. I want a graph with time across the bottom and then values as the Y values.
I have stubbed a program below for you to see where I am so far, the problem being the graph only uses the Date and not the Time also. This is obviously not very useful to me, as I end up with the same Date written along the XAxis and no way to see the time.
I have looked around for the answer to this and can't find it anywhere, so any help appreciated.
Series series1 = new Series("Input");
series1.ChartType = SeriesChartType.Line;
Random r = new Random();
Double prev = 10;
Double change = 10;
for (int x = 0; x < 10; x++)
{
change = prev - 0.5 + r.NextDouble();
series1.Points.AddXY(DateTime.Now.AddMinutes(x), change);
prev = change;
}
series1.ToolTip = "#VALX";
Chart1.Series.Add(series1);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.