How do I set up zooming a cartesian chart with a vertical x-axis?


https://www.nevron.com/Forum/Topic12171.aspx
Print Topic | Close Window

By Kevin Harrison - 7 Years Ago
How do I set up the RangeSelection to do this please?

For a standard horizontal x-axis, I use:

NRangeSelection rangeSelection = new NRangeSelection
{
HorizontalAscendingZoom = true,
ZoomOutResetsAxis = true,
HorizontalAxisId = (int) StandardAxis.PrimaryX,
VerticalAxisId = (int) StandardAxis.PrimaryY
};
chart.RangeSelections.Add(rangeSelection);

If I set
chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft);

What do I change the rangeSelection to? I've tried various permutations, but none of them allow me to zoom. I get a red rectangle dragging the selection area in all directions.

Thanks

Kevin
By Nevron Support - 7 Years Ago
Hi Kevin,

Apologies for the delayed response. You need to touch the HorizontalAscendingZoom and VerticalAscendingZoom properties of the range selection to make this work. For example:

NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

NRangeSelection rangeSelection = new NRangeSelection();

rangeSelection.HorizontalAscendingZoom = true;
rangeSelection.VerticalAscendingZoom = true;

chart.RangeSelections.Add(rangeSelection);

NBarSeries bar = new NBarSeries();

bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);

chart.Series.Add(bar);

chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft);

nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
nChartControl1.Controller.Tools.Add(new NDataZoomTool());


Hope this helps – let us know if you meet any problems or have any questions.
By Kevin Harrison - 6 Years Ago
Thanks, that works as expected.

What is the correct combination for PredefinedChartStyle.HorizontalRight please?
No combination of the two properties seems to work.

Thanks
Kevin
By Kevin Harrison - 6 Years Ago
Please ignore my previous message. I've worked it out!