Search code examples
highchartsdrilldownxrange

Highcharts xrange refuses to exhibit drilldown behavior


Attempting to create a second level of data in the xrange charttype of highcharts does not behave as expected

see jsfiddle https://jsfiddle.net/bo8eL42v/10/ and highcharts documentation https://api.highcharts.com/highcharts/series.xrange.data.drilldown

BACKGROUND - IDEAL BEHAVIOR: upon clicking on a series the chart is redrawn w/ that same series broken down into time buckets (Day || Week) as the categories -- this would allow for a Day over Day / Week over Week comparison rather than a Person by Person comparison

SubPar Alternate solution is to use the series.events.click to trigger a func that would overwrite the chart entirely w/ the DayOverDay behavior

Implemented a basic jsfiddle to test that conceptually drilldown should work as described

...
            x: Date.UTC(2014, 11, 10),
            x2: Date.UTC(2014, 11, 23),
            y: 2,
            drilldown: 'a'
        }],
        ...
    }],
    drilldown: {
        series: [{
        id: 'a',
        data: [{
            x: Date.UTC(2014, 10, 21),
            x2: Date.UTC(2014, 11, 1),
            y: 0,
            partialFill: 0.25
        },{
            x: Date.UTC(2014, 11, 1),
            x2: Date.UTC(2014, 11, 2),
            y: 0,
            partialFill: 0.25
        }]
      }]
    }

Expected: clicking on any of the datapoints where drilldown: 'a' should redraw the chart w/ only the points defined in the drilldown.series.'a' where 'a' is the id

Actual: nothing happens, no errors thrown


Solution

  • You need to include the drilldown module for the drilldown to function:

    <script src="https://code.highcharts.com/modules/drilldown.js"></script>
    

    See this JSFiddle demonstration.