chartJS line chart not plotting values that are less than minY

17 views
Skip to first unread message

bhupendra negi

unread,
Feb 3, 2020, 1:34:02 AM2/3/20
to Chart.js User Discussion
I am facing issue while plotting line chart using chartjs - https://www.chartjs.org/

Here is the codepen  example of issue , where I set the min Y value as below:

    yAxes: [{
          ticks: {
            min: minY,          
            maxTicksLimit:5
                    
                },
            gridLines: {
                display:false
            }   
        }]

However if values which are less than minY, then plotted values are not possible , if I remove minY option , then all line graphs are visible, but in my scenario , I want graph to have some initial value.

I also tried using below code instead of setting minY :

afterBuildTicks: function(scale, ticks) {
    return [minY].concat(ticks.filter(tick => tick >= minY));
}

although all plotted lines are visible but graph's initial position changes on selecting different series options.Here is the codepen for same: 

I want chart to start from some initial value , values less than initial values should also be plotted and on updating chart , graph's initial position should not change .


Thanks.
Reply all
Reply to author
Forward
0 new messages