This is a migrated thread and some comments may be shown as answers.

Pan and Zoom adjust based on legend drawing.

3 Answers 94 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Borislav
Top achievements
Rank 1
Borislav asked on 28 Jul 2017, 01:28 PM

Hello,

When implementing functionality to programmatically allow user to zoom (not to cut, but zoom, being able to zoom in/out afterwards) to particular range on the x and y axis I had an issue with pan/zoom functionality.

I used radChartView1.View.Area.AreaModel.PlotArea.LayoutSlot.Width and radChartView1.View.Area.AreaModel.PlotArea.LayoutSlot.Height to get visible area inside axes because there was always a shift caused by axes titles whose size I must also be able to change dinamically. That shift isn't constant and I had to manually calculate it based on the selected font size of chart elements. This worked fine.

However, it turned out that I have an issue when chart is redrawn from the start, with the legend shown, and my calculations are performed in such a way that radChartView1.View.Area.AreaModel.PlotArea.LayoutSlot.Width doesn't consider the legend on the right which is added after I do my calculations. My question is, is there an event which is fired after the legend is added (or any event before finally drawing chart which will still allow me to call method that I'm using to change pan/zoom) so I can use PlotArea.LayoutSlot.Width in a way that it will be the width of the plotted chart area after the legend is shown (since legend will eat some of the width I calculated).

Thanks

 

3 Answers, 1 is accepted

Sort by
0
Borislav
Top achievements
Rank 1
answered on 28 Jul 2017, 01:34 PM
I'm using version 2016.3.913.40
0
Borislav
Top achievements
Rank 1
answered on 02 Aug 2017, 12:31 PM
Anyone?
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 03 Aug 2017, 10:13 AM
Hello Borislav, 

Thank you for writing.  

There is no specific event which is fired when the legend is shown. You can use the Load or Shown event of the form after the layout for RadChartView is performed. However, if you manipulate the ShowLegend property at run time, you can force the layout by calling the following methods:
this.radChartView1.ChartElement.InvalidateMeasure(true);
this.radChartView1.ChartElement.UpdateLayout();

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ChartView
Asked by
Borislav
Top achievements
Rank 1
Answers by
Borislav
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or