c# - How to set the range of Y-axes in Zedgraph? -


i want set max , min values of axes. following code valid 1 y-axis. want set 3 y-axis.

graphpane1.yaxis.scale.min = 0;  graphpane1.yaxis.scale.max = 100; 

here codes:

var y1 = graphpane1.addyaxis("yaxis-1");  var y2 = graphpane1.addyaxis("yaxis-2");  var y3 = graphpane1.addyaxis("yaxis-3");  lineitem mycurve1 = graphpane1.addcurve(txtplottitle.text, first_pointslist, color.blue, symboltype.none); mycurve.yaxisindex = y1;  lineitem mycurve2 = graphpane1.addcurve(txtplottitle.text, second_pointslist, color.yellow, symboltype.none); mycurve.yaxisindex = y2;  lineitem mycurve3 = graphpane1.addcurve(txtplottitle.text, third_pointslist, color.green, symboltype.none); mycurve.yaxisindex = y3; 

edit: when try run code, program gave error. want graphs auto-scaled when don't write in textboxes. tryed if loop that, doesn't work.

var y1 = graphpane1.addyaxis("yaxis-1"); var y2 = graphpane1.addyaxis("yaxis-2"); var y3 = graphpane1.addyaxis("yaxis-3");  lineitem mycurve1 = graphpane1.addcurve(txtplottitle.text, first_pointslist, color.blue, symboltype.none);  mycurve.yaxisindex = y1;           graphpane1.yaxislist[y1].scale.min = double.parse(textbox1.text); graphpane1.yaxislist[y1].scale.max = double.parse(textbox2.text);  lineitem mycurve2 = graphpane1.addcurve(txtplottitle.text, second_pointslist, color.yellow, symboltype.none);  mycurve2.yaxisindex = y2; graphpane1.yaxislist[y2].scale.min = double.parse(textbox3.text); graphpane1.yaxislist[y2].scale.max = double.parse(textbox4.text);  lineitem mycurve3 = graphpane1.addcurve(txtplottitle.text, third_pointslist, color.green, symboltype.none);  mycurve3.yaxisindex = y3; graphpane1.yaxislist[y3].scale.min = double.parse(textbox5.text); graphpane1.yaxislist[y3].scale.max = double.parse(textbox6.text); 

you can loop through them in graphpane :

foreach(var axis in graphpane1.yaxislist) {   axis.scale.min = 0;   axis.scale.max = 100; } 

edit answer op in comment:

you have indices stored in y1, y2 , y3 can access them individually:

graphpane1.yaxislist[y2].scale.max = 500 // set max of y2 500  

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -