datapoints with datetime x axis in asp.net chart control
11,780
Solution 1
Did you try assigning a valid datasource with DateTime
property to the Chart. you can set the XValueType property like
Chart1.Series[0].XValueType = ChartValueType.Date; // or ChartValueType.DateTime
This should work for you.
Solution 2
You need to set it to the DateTime.ToOADate
. This will make it a double that the chart can understand.
Documentation on using DateTimes in the Chart Controls library can be found here: https://msdn.microsoft.com/en-us/library/vstudio/dd456614(v=vs.100).aspx
Author by
amit patel
Updated on June 04, 2022Comments
-
amit patel almost 2 years
I am working on asp chart control.
I need to impletment datapoints in my chart having x axis with datetime data.
I go to datapoint concept (not in too deep) but found that it gets only
double
value. My question is how can i assign my datetime values to datapoint on x axis???
-
V4Vendetta over 12 yearsWas this what you were looking for ?