Click here to Skip to main content
15,918,706 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ChartSeries series=new ChartSeries();
ChartSeriesItem item = new ChartSeriesItem();
item.XValue = DateTime.Now;
item.YValue = 22.1;
item.YValue2 = 22.3;
item.YValue3 = 22.5;
item.YValue4 = 22.6;

cs.AddItem(item);

You see in above code XValue it get error because of it only acceptance double.
Can anyone tell me how change format in chartseriesitem in date format.
Posted
Comments
Alexander Dymshyts 28-Nov-13 10:33am    
I don't think that you get set to this variable DateTime because it is made by somebody else, and it's already double, so this variable need to be double
AnthonyMG 28-Nov-13 13:20pm    
If your ChartSeries is a third party provided tool, you need to explore on it first.
if not you can try the solution provided.

1 solution

Quote:
you can use DateTime.ToOADate(). From the linked MSDN topic:


C#
double start = (zoom_time.AddMinutes(-1)).ToOADate();
double end = (zoom_time.AddMinutes(1)).ToOADate();

chart1.ChartAreas[0].AxisX.Minimum = start;
chart1.ChartAreas[0].AxisX.Maximum = end;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900