User (Old forums)MemberJanuary 25, 2007 at 5:36 amPost count: 23064
Im trying to create a chart that shows a line series with values over time.
I have created the line series, and set the x-axis to DateTime, eg.
//Format datetime axis
Axis xaxis = Chart.Charts.Axis(StandardAxis.PrimaryX);
xaxis.ScaleMode = AxisScaleMode.DateTime;
xaxis.ValueFormatting.Format = ValueFormat.CustomDateTime;
xaxis.ValueFormatting.CustomFormat = “DD/MM/YYYY hh:mm”;
I am adding values with eg.
This works fine, and I can add new values OK and they are displayed correctly. However, I want to automatically scroll the
chart when more than eg. 100 values are displayed. I tried to use the code from the examples eg.
if (m_Line1.Values.Count > nMaxCount)
int nCount = m_Line1.Values.Count – nMaxCount;
this.Chart.Charts.Axis(StandardAxis.PrimaryX).Labels.RemoveRange(0, nCount); //Exception – Count = 0
but it seems that i have no labels since the axis is set to DateTime.
How do I go about setting/refreshing the x-axis to the first DateTime value in the updated data set? If i dont change any properties on the axis, and simply delete the values the chart screws up (displaying values in the wrong location). Is there any automatic way to remove both the X/Y values and update the chart?
Imported from legacy forums. Posted by steve (had 2751 views)User (Old forums)MemberJanuary 25, 2007 at 11:57 amPost count: 23064
First, you must make sure you set the line series to use the XValues when you first set it up :
m_Line1.UseXValues = true;
Second, you must also remove the XValues from the line series :
This way, the chart will continue to display the DataPoints at the corresponding location on the DateTime axis.
Imported from legacy forums. Posted by André (had 178 views)
- You must be logged in to reply to this topic.