3

Using ZedGraph, how do I format the Y axis to show 2000 instead of 2 with a label of MyLabel(10^3)?

Otiel
  • 18,404
  • 16
  • 78
  • 126
Jim Fred
  • 1,076
  • 13
  • 27

2 Answers2

3

Set the scale's Format Property to, say, "#" and the Mag Property to zero. For example:

 YAxis y = myPane.YAxis;
 y.Scale.Format = "#";
 y.Scale.Mag = 0;
Jim Fred
  • 1,076
  • 13
  • 27
2

Set the MagAuto property to false:

zedGraph.GraphPane.YAxis.Scale.MagAuto = false;

Note that clicking on "Set Scale to Default" in the ZedGraph context menu will reset MagAuto to true. This is the source of a part of the context menu event handler:

public void ResetAutoScale( GraphPane pane, Graphics g )
{
    _scale._minAuto = true;
    _scale._maxAuto = true;
    _scale._majorStepAuto = true;
    _scale._minorStepAuto = true;
    _crossAuto = true;
    _scale._magAuto = true;
    //this.numDecAuto = true;
    _scale._formatAuto = true;
    pane.AxisChange( g );
}
Otiel
  • 18,404
  • 16
  • 78
  • 126
  • Why answer an already answered question which is 5 years old ? – Thomas Ayoub Mar 19 '15 at 12:49
  • 1
    @Thomas: I was looking how to do that myself, found this question, tested the answer provided by Jim Fred, and noticed that there was a simpler way. Figured that somebody else could benefit from my answer... – Otiel Mar 20 '15 at 11:13