Hi again @888ba8
Alignments for `navigation.buttonOptions` and `rangeSelector` are different. `navigation.buttonOptions` aligns to the spacing box, while alignment for the `rangeSelector` additionally includes required space on the left side of the chart (e.g. yAxis labels, yAxis title, etc.).
I created a plugin, that removes that addition, take a look:
https://jsfiddle.net/BlackLabel/y0jae8kw/
Plugin code:
Code: Select all
(function(H) {
H.wrap(
H.RangeSelector.prototype,
'render',
function(proceed) {
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
const rangeSelector = this,
rsOptions = rangeSelector.options,
xOffset = Highcharts.pick(rsOptions.buttonOptions && rsOptions.buttonOptions.x, 0),
spacing = Highcharts.pick(rsOptions.buttonSpacing, 5);
let left = 0;
if (rangeSelector) {
if (rangeSelector.zoomText) {
rangeSelector.zoomText.attr({
x: xOffset
});
left += xOffset + rangeSelector.zoomText.getBBox().width + 5;
}
if (rangeSelector.buttons) {
rangeSelector.buttonOptions.forEach(function(opt, i) {
rangeSelector.buttons[i].attr({
x: left
});
left += xOffset + rangeSelector.buttons[i].width + spacing;
});
}
if (rangeSelector.inputGroup) {
rangeSelector.inputGroup.attr({
translateY: rangeSelector.inputGroup.alignAttr.translateY
})
}
}
}
);
})(Highcharts);