hcharge hcharge - 7 months ago 132
Javascript Question

Is it possible to position the zoom buttons in highcharts/highstock?

As the title says, we have some charts that have two y axis on the left, and as a consequence if the screen is made smaller then the zoom buttons overlap the range inputs.

Ideally I would want the zoom buttons to always align to the left of the chart (including axis)


enter image description here

I can't find anything in the API to suggest it's possible http://api.highcharts.com/highstock#rangeSelector


Check this: How to position RangeSelector / zoom buttons at custom co-ordinates in Highstock

var orgHighchartsRangeSelectorPrototypeRender = Highcharts.RangeSelector.prototype.render;
Highcharts.RangeSelector.prototype.render = function (min, max) {
    orgHighchartsRangeSelectorPrototypeRender.apply(this, [min, max]);
    var leftPosition = this.chart.plotLeft,
        topPosition = this.chart.plotTop+5,
        space = 2;
        x: leftPosition,
        y: topPosition + 15
    leftPosition += this.zoomText.getBBox().width;
    for (var i = 0; i < this.buttons.length; i++) {
            x: leftPosition,
            y: topPosition 
        leftPosition += this.buttons[i].width + space;