1

I can set these values in the initial options object and everything works fine. If I later change the options using chart.options.yAxis.tickInterval for instance, they seem to get ignored when redrawing the yAxis.

    // Global variables
var markInterval = undefined;
var minInterval = 0;
var maxInterval = undefined;

chart = new Highcharts.Chart({
        // ... 
        yAxis: {
            title: {
                text: 'Mark'
            },
            labels: {
                formatter: function() {

                    // html formatting
                },
                useHTML: true
            },
            tickInterval: markInterval,
            min: minInterval,
            max: maxInterval
        },
        plotOptions: {
            series: {
                events: {
                    legendItemClick: function(event) {
                        // setTickIntervals(); Change the global values markInterval, minInterval and maxInterval
                        chart.options.yAxis.tickInterval = markInterval;
                        chart.options.yAxis.min = minInterval;
                        chart.options.yAxis.max = maxInterval;
                        chart.redraw();
                    }
                }
            }
        }
    });
1
  • How do you redraw the chart, can you put some code?
    – cubbuk
    Jan 9, 2013 at 23:10

1 Answer 1

12

I was incorrectly setting the new values, eg:

chart.options.yAxis.tickInterval = markInterval;

should be

chart.yAxis[0].options.tickInterval = markInterval;

then everything works as expected.

3
  • got it working yay, wondering why didn't redraw work: jsfiddle.net/wJESU/3
    – igrek
    Oct 10, 2013 at 9:53
  • 1
    I've solved a similar problem with the tickPositions array by updating the yAxis.options as Dale says, and then: chart.yAxis[0].isDirty = true; chart.redraw();
    – guidoman
    Oct 30, 2014 at 9:36
  • Doesn't work. Highcharts seems to replace tickInterval with its own preferred values, which look rubbish.
    – garryp
    Jan 14, 2016 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.