1
votes

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, (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

1
Dont know if will help, but try to use yourSeries.XValueType = ChartValueType.Int32 - Stecya
Tried that but same thing still occurs and thank you also for helping :) I also tried to use the RoundAxisValue() and still no difference :( - YoungCoder
Can you provide working code snippet, cause ChartAreas[0] doesn't have Minimum field - Stecya
Hi I have updated the code now should work and thank you so much for your time I really appreciate the help :) - YoungCoder
Cant reproduce yor problem, but try no to cast (i/100) to double - Stecya

1 Answers

0
votes

than you can use LabelStyle.Format for displaying labels.

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