winforms - Adding a scroll bar to MS Chart control C# -
please understand know there other threads concerning issue, needs different.
basically before seen people saying implement scroll bar mschart use
.size = ...
or
.view = ...
but, make scroll bar automatically apprear, , scroll bar contains button when clicked causes bar vanish, making chart show data, , no way of bringing scroll bar chart without restarting app.
so ask, please, there way incorportate horizontal scroll bar on x-axis of chart? needing on can view chart data on blocks of 100 second blocks.
i.e. 0 - 100, click sroll bar bring me 100 - 200 block.
thank in advance guys!!!!! im coding in c# also
here's example of need:
(to try it, create form, add mschart , call following method)
private void fillchart() { int blocksize = 100; // generates random data (i.e. 30 * blocksize random numbers) random rand = new random(); var valuesarray = enumerable.range(0, blocksize * 30).select(x => rand.next(1, 10)).toarray(); // clear chart chart1.series.clear(); // fill chart var series = chart1.series.add("my series"); series.charttype = seriescharttype.line; series.xvaluetype = chartvaluetype.int32; (int = 0; < valuesarray.length; i++) series.points.addxy(i, valuesarray[i]); var chartarea = chart1.chartareas[series.chartarea]; // set view range [0,max] chartarea.axisx.minimum = 0; chartarea.axisx.maximum = valuesarray.length; // enable autoscroll chartarea.cursorx.autoscroll = true; // let's zoom [0,blocksize] (e.g. [0,100]) chartarea.axisx.scaleview.zoomable = true; chartarea.axisx.scaleview.sizetype = datetimeintervaltype.number; int position = 0; int size = blocksize; chartarea.axisx.scaleview.zoom(position, size); // disable zoom-reset button (only scrollbar's arrows available) chartarea.axisx.scrollbar.buttonstyle = scrollbarbuttonstyles.smallscroll; // set scrollbar small change blocksize (e.g. 100) chartarea.axisx.scaleview.smallscrollsize = blocksize; }
snapshot:
Comments
Post a Comment