Zoom and multi Yaxis


Author
Message
Hans Henrik Friis Pedersen...
Hans Henrik Friis Pedersen
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 28, Visits: 136
Hi,

I'm adding a NDataZoomTool and a NSelectorTool and a NDataPanTool() to a NCartesianChart followed by adding a RangeSelections


m_Chart.RangeSelections.Add(new NRangeSelection());


NDataZoomTool m_DataZoomTool = new NDataZoomTool();
ChartControl.Controller.Tools.Add(m_DataZoomTool);
ChartControl.Controller.Tools.Add(new NSelectorTool());
NDataPanTool dpt = new NDataPanTool();
ChartControl.Controller.Tools.Add(dpt);


I would like to perform a Zoom of a muliYaxis plot, see Image 1. However, when I try to Zoom in a on part of the graph only the left Y-axis is scaled according the zoom - the right Y-axis is not scaled (is ot affected by the zoom) - see attached Image 2 and Image 3.

Attachments
Image_1.png (500 views, 206.00 KB)
Image_2.png (520 views, 227.00 KB)
Image_3.png (514 views, 297.00 KB)
Replies
joern kunze
joern kunze
Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)
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
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi All,
You can also check out the following example - All Examples \ Interactivity \ Tools \ Multiple Axes Zooming and Scrolling - it shows how to simultaneously zoom in / out two vertical axes.



Best Regards,
Nevron Support Team


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Joern,

Most likely you have the NDataZoomTool added before the NAxisScrollTool in the tools collection.
You need to make sure that the NAxisScrollTool is added first in the collection and you should not get the end drag event fired at all. Let us know if the problem persists.


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search