conbask
conbask

Reputation: 10061

Adding date range filter to Highcharts chart

Is it possible to add an x-axis range selector to a Highcharts chart or is that functionality only built into Highstock?

Here's my code:

$('#graph').highcharts({
    title: {
        text: 'GRAPH TITLE',
        margin: 25
    },
    xAxis: [{
        categories: ['03/28','03/29','03/30','03/31','04/01','04/02','04/03','04/04','04/05','04/06','04/07','04/08','04/09']
    }],
    yAxis: {
        title: {
            enabled: false
        },
        plotLines: [{
            value: 0,
            width: 1,
            color: '#808080'
        }],
        min: 0
    },
    legend: {
        layout: 'vertical',
        borderWidth: 0,
        enabled: false
    },
    series: [{
        data: [27893,89070,90592,112166,68395,62448,39237,28439,21973,24064,56032,52854,38736]
    }],
    tooltip: {
        enabled: false
    },
    plotOptions: {
        area: {
            dataLabels: {
                enabled: true,
                y: -5,
                align: 'center'
            }
        }
    },
    credits: {
        enabled: false
    },
    exporting: {
        enabled: false
    },
    chart: {
        type: 'area'
    }
});

Upvotes: 3

Views: 5241

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

Yes, it's possible, but rangeSelector works only with datetime axis.

Anyway, you will need valid Highstock license to enable rangeSelector, see FAQ.

Upvotes: 1

Related Questions