|
Group: Forum Members
Posts: 86,
Visits: 221
|
Hello Hans,
I have had a similar problem - and couldnt find sort of build in function to do so. Hence I implemented it manually:
Implement the following within the OnDataZoom_EndDrag - Event: NRange1DD contentRange = oChart.Axis(StandardAxis.PrimaryX).ViewRange; NRange1DD viewRange = oChart.Axis(StandardAxis.PrimaryX).Scale.RulerRange; double beginFactor = contentRange.GetValueFactor(viewRange.Begin); double endFactor = contentRange.GetValueFactor(viewRange.End);
bool bolXZoomActive = (beginFactor == 0.0 && endFactor == 1.0) ? false : true;
// compute factors Y Zoom contentRange = oChart.Axis(StandardAxis.PrimaryY).ViewRange; viewRange = oChart.Axis(StandardAxis.PrimaryY).Scale.RulerRange; beginFactor = contentRange.GetValueFactor(viewRange.Begin); endFactor = contentRange.GetValueFactor(viewRange.End);
bool bolYZoomActive = (beginFactor == 0.0 && endFactor == 1.0) ? false : true;
if (_PlotData.MultipleYAxis && true) { //NewFeature: MultipleYAxis 2014_09 // then for all other y axes make sure their view range factor equals to begin/end factor if (bolYZoomActive) { // disable Scrollbar for all Y-Axis except primary YAxis foreach (NAxis axis in oChart.Axes) { if (axis.AxisId != (int)StandardAxis.PrimaryY && axis.AxisOrientation == AxisOrientation.Vertical) { axis.PagingView.Enabled = true;
// compute the new range based on factor NRange1DD axisContentRange = axis.ViewRange; double rangeLength = axisContentRange.End - axisContentRange.Begin;
double begin = axisContentRange.Begin + beginFactor * rangeLength; double end = axisContentRange.Begin + endFactor * rangeLength;
axis.PagingView.ZoomIn(new NRange1DD(begin, end), 0.0001); } }
} else { // full view no zoom foreach (NAxis axis in oChart.Axes) { if (axis.AxisId != (int)StandardAxis.PrimaryY && axis.AxisOrientation == AxisOrientation.Vertical) { axis.PagingView.Enabled = false; } } }
}
bool bolRecalcLayout = _PlotData.MultipleYAxis;
Maybe afterwards you have to do the following as well: _NevronChart.document.Calculate(); //ruler values must be calculated first _NevronChart.document.RecalcLayout(_NevronChart.View.Context); _NevronChart.Refresh();
Best regards, Joern
|