c# - Implementing scroll bar along x-axis -


i trying implement scroll bar along x-axis, failed , can 1 please......this code:

namespace windowsformsapplication2 {     public partial class form1 : form     {         chart chart2 = new chart();         chart chart3 = new chart();         int[] rand;         int[] rand1;         public form1()         {             initializecomponent();         }         private void form1_load(object sender, eventargs e)     {          chart2.width = 1000 ;         chart2.height = 200;         this.controls.add(chart2);         this.controls.add(chart3);          chart2.mousemove += new mouseeventhandler(chart2_mousemove);        //chart2.gettooltiptext += new eventhandler<tooltipeventargs>(chart2_gettooltiptext);          chart2.chartareas.add("area");             chart2.chartareas[0].cursorx.autoscroll = true;         chart2.chartareas[0].cursorx.interval = 1;          chart2.chartareas[0].axisx.labelautofitstyle = labelautofitstyles.none;         chart2.chartareas[0].axisx.isstartedfromzero = true;         chart2.chartareas[0].axisx.minimum = 0;          chart2.chartareas[0].axisx.scaleview.sizetype = datetimeintervaltype.number;         chart2.chartareas[0].axisx.majortickmark.interval = .5;         chart2.chartareas[0].axisx.scrollbar.ispositionedinside = true;         chart2.chartareas[0].axisx.scrollbar.buttonstyle = scrollbarbuttonstyles.smallscroll;         chart2.chartareas[0].axisx.scaleview.smallscrollsize = 100;         chart2.chartareas[0].axisx.scrollbar.enabled = true;           chart2.chartareas[0].axisy.isstartedfromzero = true;          int[] x = new int[100];         (int = 0; < 50; i++)         {              x[i] = i+1;         }         int[] y = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };         chart2.series.add("alpha");         chart2.series.add("beta");         chart2.series["alpha"].charttype = seriescharttype.line;         chart2.series["beta"].charttype = seriescharttype.line;          chart2.series["alpha"].color = color.blue;         chart2.series["beta"].color = color.darkgreen;         chart2.series["alpha"].xvaluetype = chartvaluetype.double;         chart2.series["beta"].xvaluetype = chartvaluetype.double;         //chart2.series[0].           chart2.series["alpha"].yvaluetype = chartvaluetype.double;         chart2.series["beta"].yvaluetype = chartvaluetype.double;           legend leg = new legend();         chart2.legends.add(leg);         chart2.legends[0].alignment = stringalignment.near;            random _r = new random();         rand = new int[1000];         rand1 = new int[1000];         (int = 0; < x.length; i++)         {             int n = _r.next(0, 100);             rand[i] = n;             chart2.series["alpha"].points.addy(n);         }          (int = 0; < x.length; i++)         {             int n = _r.next(0, 100);             rand1[i] = n;             chart2.series["beta"].points.addy(n);         }         chart2.series[0].tooltip = "x = #valx, y= #valy";         chart2.series[1].tooltip = "x = #valx, y= #valy";      }      private void chart2_click(object sender, eventargs e)     {      }      private void chart2_mousemove(object sender, mouseeventargs e)     {         hittestresult htr = this.chart2.hittest (e.x, e.y);         point p = new point(e.x, e.y);         int k = convert.toint32(p.x);         chart2.chartareas[0].cursorx.interval = 0;         chart2.chartareas[0].cursorx.setcursorpixelposition(p,true);         //chart2.chartareas[0].cursory.setcursorpixelposition(p, true);         //label xlbldisplay = new label();         //xlbldisplay.text = "x";          //label ylbldisplay = new label();         //ylbldisplay.text = "y";         chart2.series[0].tooltip = "x = #valx, y= #valy";         //string p = chart2.gettooltiptext;         if (convert.toint32(chart2.chartareas[0].cursorx.position) <= 1000)         {             axdisplay.text = convert.tostring(convert.toint32(chart2.chartareas[0].cursorx.position));              aydisplay.text = convert.tostring(rand[convert.toint32(axdisplay.text)]);             bxdisplay.text = axdisplay.text;             bydisplay.text = convert.tostring(rand1[convert.toint32(axdisplay.text)]);         }        }      //private void chart2_gettooltiptext(object sender, tooltipeventargs e)     //{     //    hittestresult rt = chart2.hittest(e.x, e.y);     //    if(rt.chartelementtype == chartelementtype.datapoint)     //    {     //        xdisplay.text = chart2.series[0].points[rt.pointindex].xvalue.tostring();      //        ydisplay.text = chart2.series[0].points[rt.pointindex].yvalues[0].tostring();     //    }     //    //ydisplay.text = e.y.tostring();     //}      //private void chart2_cursorpositionchanged(object sender, cursoreventargs e)     //{     //    //hittestresult htr = this.chart2.hittest(e.x, e.y);     //    //point p = new point(e.x, e.y);      //    //chart2.chartareas[0].cursorx.interval = 0;     //    //chart2.chartareas[0].cursorx.setcursorpixelposition(p, true);     //    //chart2.chartareas[0].cursory.setcursorpixelposition(p, true);     //}        } 

}


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -