Home Forums Chart Support unwanted Y-axis values

unwanted Y-axis values

Viewing 7 posts - 1 through 7 (of 7 total)
  • #23015

    why is the x-axis and y-axis having negative values when there is no data in that range




    In the JSFiddle that you have shared, y-values being used are very small. To avoid unwanted negative values you can set axisY minimum to 0.
    Please take a look at this updated JSFiddle.

    Shashi Ranjan
    Team CanvasJS


    I know about the minimum value property, but data is dynamic and I won’t know if values go below 0 or not,
    So this won’t work
    As far as I know this should get calculated automatically by the library if I am not providing any minimum value



    Minimum ans maximum of axis gets calculated automatically by the library. But in few cases of very small values, minimum gets calculated to lessthan 0. We will reconsider this behavior in out future releases. However you can workaround this by checking if there are any negative dataPoints or not, even incase of dynamic charts. Please take look at this updated JSFiddle.


    Setting minimum / maximum causes other issues

    like here : https://jsfiddle.net/QwZuf/2685/

    If you click on the legend then the YAxis will not hide and will show some random set of numbers.
    If you remove the minimum property and try again, then the yaxis will hide

    This does not look like a problem in this case but if I have another series

    then on hiding one series does not hide its corresponding axis and it is not visible to which axis a series is on.

    Apart from this if the x-axis is of time date-time and if the y-axis has minimum/maximum set then hiding series causes console errors and sometimes the page stops working due to those breakages.

    So that is why I want to avoid setting minimum / maximum on the axis



    It seems to be working fine even with date-time axis. Please take a look at this JSFiddle.

    In case you’re still facing the issue, kindly share a JSFiddle reproducing the same issue and steps to reproduce the issue, so that we can try it at our end, understand your usecase better and help you out.
    Shashi Ranjan
    Team CanvasJS


    In the fiddle you are explicitly doing this
    e.chart.options.axisY2[0].minimum = null

    For the console error case, I’ll log a ticket once I am able to reproduce a small consumable code for it.

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

You must be logged in to reply to this topic.