Nevron Forum

Zooming in multiple chart controls

https://www.nevron.com/Forum/Topic3636.aspx

By Dieter Spiegel - Monday, June 7, 2010

Hi, I have 8 charts in 8 separate chart controls. When the user zooms in the first chart (data zoom tool) I want to update the view ranges of all the other charts. I am not sure which event I need to catch that tells me that the zoom operation is done and the first chart is updated. Right now I am catching the mouse up event and use a timer to update the other charts. This works, but it doesn't seem to be the right way to do this.

I'd appreciate any help.

Thanks

Dieter
By Blagovest Milanov 1 - Tuesday, June 8, 2010

Hi Dieter,

You can intercept the data zoom tool end drag event:

dataZoomTool.EndDrag += new EventHandler(OnDataZoomTool_EndDrag);
void OnDataZoomTool_EndDrag(object sender, EventArgs e)
{
  // do synchronization here
}

Alternatively you can have master slave axes as shown in the following example:

Interactivity\Tools\Axis Scroll tool.

That way the control will automatically synchronize the range of charts.

Let me know if you meet any problems.

Best regards,
Bob


 

By Dieter Spiegel - Wednesday, June 9, 2010

Thanks Bob. That works great.

Dieter
By Dieter Spiegel - Friday, June 11, 2010

Bob, I still have an issue with the synchronized zooming and updating the other charts, and I am not sure if it's on my side or if it's a bug in the software.  I attached a sample project.  I have 5 chart controls in a form with scrollbars.  When the first chart is zoomed all other charts are updated.

The problem is that the chart that is outside the view is not updated, unless it was scrolled into view at least once.

To reproduce the problem:

1. after launching the program zoom in the first chart

2. scroll to the last chart - the charts that are not in the view are not updated

 

And this way it works:

1. after launching the program scroll to the last chart

2. then scroll to the top

3. zoom in the first chart - all charts are updated correctly

Any idea what I am doing wrong?

 

Thanks

Dieter

 

By Dieter Spiegel - Tuesday, June 22, 2010

Did anybody have a chance to look at this issue?

Thanks

Dieter
By Blagovest Milanov 1 - Wednesday, June 23, 2010

Hi Dieter,

It may be that when you apply to zoom range the charts that are not visible are not calculated yet - try adding the following code at the end of the FillChartWithRandomData function - this will ensure the chart ranges are calculated and the zoom in range does not get truncated:

private void FillChartWithRandomData(NChartControl nCC)
{

nCC.Document.Calculate();
nCC.Document.RecalcLayout(nCC.View.Context);
}

Let me know if the problem persists...

Best regards,
Bob

By Dieter Spiegel - Thursday, June 24, 2010

Thanks Bob. That worked.

Regards

Dieter