NDataZoomTool Save / Restore Selected Range


Author
Message
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 James,
Can you send us a small code snippet that replicates that?

Best Regards,
Nevron Support Team


Timothy Dishop
Timothy Dishop
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: 10, Visits: 63
The one issue I just noticed is that when I initially zoom to one month in a year of data the x scale is in days.  When I set it to the cloned data the x scale is in months?
Timothy Dishop
Timothy Dishop
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: 10, Visits: 63
Is there a way to capture when the red circle close button click?
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 James,
The scrollbar will fire the reset event when clicked:
   chart.Axis(StandardAxis.PrimaryX).ScrollBar.Reset += ScrollBar_Reset;
...
   private void ScrollBar_Reset(object sender, EventArgs e)
   {
    MessageBox.Show("Reset pressed");
   }

Let us know if you meet any problems...

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 James,

The zoom information is stored in the PagingView object attached to the axis. In order to save / restore the zoom level for a particular axis you can clone the view object and then assign it later to the axis when you want to restore the zoom to a previous state. The following code example shows how to do that:
private void Form1_Load(object sender, EventArgs e)
{
    NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
    chart.RangeSelections.Add(new NRangeSelection());

    NBarSeries bar = new NBarSeries();
    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);
    chart.Series.Add(bar);

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

   NAxisPagingView xView;
   NAxisPagingView yView;

   private void button1_Click(object sender, EventArgs e)
   {
    NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
    xView = (NAxisPagingView)chart.Axis(StandardAxis.PrimaryX).PagingView.Clone();
    yView = (NAxisPagingView)chart.Axis(StandardAxis.PrimaryY).PagingView.Clone();
   }

   private void button2_Click(object sender, EventArgs e)
   {
    NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
    chart.Axis(StandardAxis.PrimaryX).PagingView = (NAxisPagingView)xView.Clone();
    chart.Axis(StandardAxis.PrimaryY).PagingView = (NAxisPagingView)yView.Clone();

    nChartControl1.Refresh();
   }
Hope we helped - let us know if you meet any problems or have any questions.

Best Regards,
Nevron Support Team


Timothy Dishop
Timothy Dishop
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: 10, Visits: 63
Is there a way to save the current zoom and then restore it?

I have issues where the chart is cleared and restored during different events. It seems that it would be easiest to save the zoom and restore it on the new view.

Thanks 

Jim
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