Chart not clearing properly c# -
when getvalue button pressed chart behaves expected, when clearchart button pressed chart clears, numbers on x axis decimals e.g 1.99999999,2.99999999. seems x axis not being reset scroll bar @ bottom not keep right after chart cleared. how chart clear , start off @ start of program? here code.
int i; random rnd = new random(); private void chart_load(object sender, eventargs e) { chart1.series.add("temp"); chart1.series["temp"].charttype = seriescharttype.spline; chart1.series["temp"].isvisibleinlegend = false; } private void getvalue_click(object sender, eventargs e) { chart1.chartareas["chartarea1"].axisx.scaleview.zoom(0, 20); chart1.chartareas["chartarea1"].axisx.scaleview.smallscrollsize = 20; chart1.series["temp"].points.addxy(i, rnd.next(1, 10)); i++; chart1.chartareas["chartarea1"].axisx.scaleview.position = chart1.series["temp"].points.count - chart1.chartareas["chartarea1"].axisx.scaleview.size; } private void clearchart_click(object sender, eventargs e) { chart1.series["temp"].points.clear(); }
try clearing points of chart.
add following clear handler:
chart1.series["temp"].points.clear();
Comments
Post a Comment