Page 1 of 1

Multiple axis with zooming

Posted: Mon Sep 25, 2006 2:19 pm
by 9792366
For Charts with multiple axis if we apply zooming it works only with first left axis and the labels on x axis are displayed only only for first left axis.

Posted: Mon Sep 25, 2006 2:22 pm
by narcis
Hi Vikas,

Yes, custom axes don't zoom. However you can implement this by doing something like what's told on this FAQ item.

Posted: Wed Sep 27, 2006 8:57 am
by 9792366
Hi,
The Response in FAQ is for Delphi. Can we get c# code. We have Custom" axes labels (Y-axes) that are not getting updated after zoom.

Thanks
Vikas

Posted: Wed Sep 27, 2006 10:06 am
by narcis
Hi Vikas,

I've added two line series, line2 having a vertical custom axis (axis1) associated with custom labels. Zoom works fine for the custom axis using this code:

Code: Select all

    private void Form1_Load(object sender, EventArgs e)
    {
      line1.FillSampleValues();
      line2.FillSampleValues();

      axis1.Labels.Items.Clear();

      for (int i = 0; i < line2.Count; i++)
      {
        axis1.Labels.Items.Add(line2.YValues[i]);
      }
    }

    private void tChart1_Zoomed(object sender, EventArgs e)
    {
      axis1.SetMinMax(axis1.CalcPosPoint(tChart1.Zoom.y1), axis1.CalcPosPoint(tChart1.Zoom.y0));
    }

    private void tChart1_UndoneZoom(object sender, EventArgs e)
    {
      axis1.Automatic = true;
    }