开发者

MSCHart X-axis values showing error

开发者 https://www.devze.com 2023-02-17 21:44 出处:网络
I havs an MSChart which takes in a series of data elements foreach(Int16 element in data) { this.view.chart.Series[\"Series1\"].Points.AddXY((double)i/100,开发者_C百科 (double) element/41);

I havs an MSChart which takes in a series of data elements

foreach(Int16 element in data)
{
    this.view.chart.Series["Series1"].Points.AddXY((double)i/100,开发者_C百科 (double) element/41);
}
this.view.chart.ChartAreas[0].AxisX.Mimimum=0;
this.view.chart.ChartAreas[0].AxisX.Interval = 1;
this.view.chart.ChartAreas[0].AxisX.ScaleView.Zoom(0,10);
this.view.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollSize = 10;

This views the the chart in 10 second frames, so this should go from 0 - 10, then 10 to 20, etc. Now the strange thing is, when I first launch the chart, it correctly shows the data within the time frame 0 to 10. BUT when I fist click to scroll forward to the next 10 second frame, it shows 9.994 to 19.994, then 19.994 to 29.994.

Now, if I scroll all the way back to the start (i.e. 0 top 10) and then scroll forward again it WORKS! goes from 0 - 10, 10 - 20, 20 - 30 but when I reach the end of my chart ot goes back into the annoying double value (e.g. 69.994) :S

I really cant figure out why this is happening, could anyone help me please

PS. This is a line chart not a bar chart


than you can use LabelStyle.Format for displaying labels.

chart1.ChartAreas[0].AxisX.LabelStyle.Format = "{0.0}";
0

精彩评论

暂无评论...
验证码 换一张
取 消