Home forums Using CanvasJS unwanted Y-axis values

This topic contains 6 replies, has 2 voices, and was last updated by  himanshu_tanwar 1 month, 2 weeks ago.

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

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

    https://jsfiddle.net/QwZuf/2671/

    #23025

    shashiranjan
    Member

    @himanshu_tanwar,

    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

    #23028

    @shashiranjan
    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

    #23052

    shashiranjan
    Member

    @himanshu_tanwar,

    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.

    #23063

    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
    https://jsfiddle.net/QwZuf/2686/

    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

    #23101

    shashiranjan
    Member

    @himanshu_tanwar,

    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

    #23150

    @shashiranjan
    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.