Pan and Zoom adjust based on legend drawing.

4 posts, 0 answers
  1. Borislav
    Borislav avatar
    17 posts
    Member since:
    Nov 2016

    Posted 28 Jul Link to this post

    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

     

  2. Borislav
    Borislav avatar
    17 posts
    Member since:
    Nov 2016

    Posted 28 Jul Link to this post

    I'm using version 2016.3.913.40
  3. Borislav
    Borislav avatar
    17 posts
    Member since:
    Nov 2016

    Posted 02 Aug Link to this post

    Anyone?
  4. Dess
    Admin
    Dess avatar
    2107 posts

    Posted 03 Aug Link to this post

    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.
Back to Top