mojtaba357 mojtaba357 - 3 months ago 40
C# Question

Nevron Chart X Axis

I have some charts and want if user zoom into a chart, other charts show the same range on X axis and left lines of charts fit in a common vertical line(as shown in the picture)

how to that in Nevron charts?

enter image description here

Answer

The following code shows how to synchronize the ranges of the x axes as well as how to align the charts left panels:

  1. Synchronize the axis range:

        // make axes master slave
        chart1.Axis(StandardAxis.PrimaryX).Slaves.Add(chart2.Axis(StandardAxis.PrimaryX));
        chart2.Axis(StandardAxis.PrimaryX).Slaves.Add(chart1.Axis(StandardAxis.PrimaryX));
    
  2. Align the charts:

        // align the charts
        NSideGuideline guideline = new NSideGuideline(PanelSide.Left);
        guideline.Targets.Add(chart1);
        guideline.Targets.Add(chart2);
        nChartControl1.Document.RootPanel.Guidelines.Add(guideline);