Home forums Using CanvasJS Keep range when hide data.

This topic contains 3 replies, has 2 voices, and was last updated by  Indranil Deo 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19390

    intijk
    Member

    Hi current canvasjs has 2 issues that when hide some data series,

    1. the re-render logic does not keep the range of the chart, it changes every time, which looks bad when toggle series on/off
    2. When all data series removed, re-render will even refuse to render the coordinate system.

    This is bad, I want to achieve some click effect to keep the range of the system and when all data series are hided, still keep the display of the coordinate, could you provide an option to let re-render aware of this?

    #19405

    Indranil Deo
    Member

    @intijk,

    1. the re-render logic does not keep the range of the chart, it changes every time, which looks bad when toggle series on/off

    This is an intended behavior, the axes range depends on the x and y-values of dataSeries shown. When a dataSeries is hidden, the range of the axes changes based on the x and y-values of the dataSeries visible.

    2. When all data series removed, re-render will even refuse to render the coordinate system.

    As there are no dataSeries to be shown the axes won’t be associated with any dataSeries hence there won’t be any range.

    Still, setting the minimum and maximum for the axes will work fine in your case. Please take a look at this jsfiddle.

    ___________
    Indranil Deo,
    Team CanvasJS

    #19674

    intijk
    Member

    Hi Indranil:

    Thank you for your reply, I think that is the answer I need.

    But I have a suggestion, instead of let user do this every time:

    `
    chart.axisY[0].set(“minimum”, chart.axisY[0].get(“minimum”));
    chart.axisY[0].set(“maximum”, chart.axisY[0].get(“maximum”));
    chart.axisX[0].set(“minimum”, chart.axisX[0].get(“minimum”));
    chart.axisX[0].set(“maximum”, chart.axisX[0].get(“maximum”));
    `

    why not provide an option to let user do this easier?

    `
    chart.keepRangeNextRender();
    chart.render();
    `

    #19677

    Indranil Deo
    Member

    @intijk,

    Thanks for the suggestion. We will reconsider the behavior in future releases.

    _________
    Indranil Deo,
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.