Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Rerendering chart after series has been toggled on/off in legend
posted

Hello!

We recently implemented an function to show/hide certain series in a chart. Now we would like for the chart to recalculate the axis, because you can get significant whitespace if an exceptionally long/heigh chart is hidden.

For an example, in the following stackblitz, if you hide the column "1 Werkbegroting", I would like to rerender the chart with a max x of 200.000, instead of the 400.000 it keeps showing

stackblitz.com/.../github-8zw4gw-lgrhoj

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello Jonas,

    With the current implementation of the IgxDataChart, the auto calculated minimum and maximum values of the axes will be reflected regardless of the visibility of the series as the series is still “plotted” in the chart and has a corresponding axis.

    Something you can do in this case to prevent this is to mark the “value axis” as null. In the case of the StackBlitz you provided, this would be the X-Axis as you are using an IgxBarSeries. You could mark the xAxis as null in the render function that changes the series visibility, but keep in mind that you will need to set it back when you make the series visible again or the series will not be rendered.

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.

Children
No Data