1
votes

I am trying to increase/decrease Max and Min value of Y axis in a ZedGraph. When I create the form, the graph draws as normal, but after first draw I want to change the scale of Y axis using 2 numericUpDown controls...but it never updates :(

Here is the code I am using:

private void CreateGraph()
{
    // Set the Titles
    myPane.Title.Text = gs.Title;
    myPane.XAxis.Title.Text = gs.xTitle;
    myPane.YAxis.Title.Text = gs.yTitle;

    //Add data
    myPane.AddCurve(gs.LineLabel, gs.RawData, gs.LineColor);

    zedGraphControl1.AxisChange();
}


private void nudYMax_ValueChanged(object sender, EventArgs e)
{
    this.zedGraphControl1.GraphPane.YAxis.Scale.Max = (double)nudYMax.Value;
    zedGraphControl1.AxisChange();
}

private void nudYMin_ValueChanged(object sender, EventArgs e)
{
    this.myPane.YAxis.Scale.Min = (double)nudYMin.Value;
    zedGraphControl1.AxisChange();
}
1

1 Answers

4
votes

It's a long time ago since i worked with the ZedGraph library but if I remember correctly you have to call

    zedGraphControl1.Refresh();

after your axis change.