}
}
+ // Make sure min <= max when only min or max is defined by user and the data is outside that range
+ min = maxDefined && min > max ? max : min;
+ max = minDefined && min > max ? min : max;
+
return {
min: finiteOrDefault(min, finiteOrDefault(max, min)),
max: finiteOrDefault(max, finiteOrDefault(min, max))
expect(chart.scales.y.max).toBe(150);
});
+ it('Should handle when only a min value is provided', () => {
+ var chart = window.acquireChart({
+ type: 'line',
+ data: {
+ datasets: [{
+ yAxisID: 'y',
+ data: [200]
+ }],
+ },
+ options: {
+ scales: {
+ y: {
+ type: 'linear',
+ min: 250
+ }
+ }
+ }
+ });
+
+ expect(chart.scales.y.min).toBe(250);
+ });
+
it('Should handle when only a max value is provided', () => {
var chart = window.acquireChart({
type: 'line',