Link to home
Start Free TrialLog in
Avatar of kingy0489
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.
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);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of tetorvik
tetorvik
Flag of Finland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial