I have a function which creates a chart and adds data dynamically. It is supposed to plot rain and rain speed. See code below.
The both Y-axis have a minimum of 0 and a softMax of 1. However, the Y-axis does not seems to go below 6 while I would expect it to go from 0-1 when there are no data to show and then adjust as required.
Why does the Y-axis not go from 0 to 1 but has the minimal MAX value if 6 (beyond which it does scale up OK) ?
Code: Select all
function doRegen() {
chart = Highcharts.StockChart('chartcontainer', {
credits: {
enabled: true
},
xAxis: {
type: 'datetime',
crosshair: true,
ordinal: false,
dateTimeLabelFormats: {
day: '%e %b',
week: '%e %b %y',
month: '%b %y',
year: '%Y'
}
},
yAxis: {
id: 'Rain',
title: {
text: 'Regen (mm)'
},
opposite: false,
softMax: 1,
min: 0,
allowDecimals: false,
labels: {
align: 'right',
x: -5,
y: -2
}
},
legend: {
enabled: true
},
plotOptions: {
series: {
states: {
hover: {
halo: {
size: 5,
opacity: 0.25
}
}
},
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 0.1
}
}
}
},
},
tooltip: {
shared: true,
split: true,
valueDecimals: 1,
xDateFormat: '%A, %b %e, %H:%M'
},
series: [],
rangeSelector: {
buttons: [{
count: 18,
type: 'hour',
text: '18h'
}, {
count: 36,
type: 'hour',
text: '36h'
}, {
type: 'all',
text: 'All'
}],
inputEnabled: false
}
});
chart.showLoading();
chart.setTitle({
text: 'Regen and Regensnelheid'
});
chart.addAxis({
id: 'Rrate',
title: {
text: 'Regensnelheid (mm/hr)'
},
opposite: true,
softMax: 1,
min: 0,
allowDecimals: false,
labels: {
align: 'left',
x: 5,
y: -2
}
}, false, false);
Promise.all([]).then(() => {
RegenAddSeries(chart);
chart.hideLoading();
chart.redraw();
});
}