Chartjs-Boxplot chartjs make min and max dynamic by leaving some space on both side

0👍

While sending data from the server, you can send min and max value as well, and then use suggestedMin and suggestedMax

yAxes: [{
    ticks: {
        suggestedMin: receivedMinVal - 10,
        suggestedMax: receivedMaxVal + 10,
        }
    }
}]

where received Val refers to the value sent from the server. You can also use a js function to find the min and max values from the array. Suggested values will always increase the value by keeping the ratio of stepsize.

If you would like to learn more about this, read the documentation. You could read all about it at https://www.chartjs.org/docs/latest/axes/cartesian/linear.html#axis-range-settings

Leave a comment