简体   繁体   中英

Highcharts Level 3 drill down

I have a Highchart column like this:

  • Level-1 contains yearly graph
  • Level-2 contains monthly graph where its year
  • Level-3 contains animals where its year and month

But when level 3 opened, it shows some data with latest data, for example: in 2017 January, i have 7 animals. In 2016 January i have 6 animals. And it show me only 7 animals at point 2016 january. Is it possible to show some data from database with 2 conditions?

Please let me know where my mistake is.

Here is a sample of the drill down I am working on:

$(function () {

// Create the chart
$('#container').highcharts({
    chart: {
        type: 'column'
    },
    title: {
        text: 'Basic drilldown'
    },
    xAxis: {
        type: 'category'
    },

    legend: {
        enabled: false
    },

    plotOptions: {
        series: {
            borderWidth: 0,
            dataLabels: {
                enabled: true,
            }
        }
    },

    series: [{
        name: 'Things',
        colorByPoint: true,
        data: [{
            name: '2017',
            y: 5,
            drilldown: '2017'
        },
        {
            name: '2016',
            y: 4,
            drilldown: '2016'
        }]
    }],
    drilldown: {
        series: [{
            id: '2017',
            name: '2017',
            data: [{
                name: 'January',
                y: 7,
                drilldown: 'january'
            },{
                name: 'July',
                y: 5,
                drilldown: 'july'
            },
            ],
        },
        {
            id: '2016',
            name: '2016',
            data: [{
                name: 'January',
                y: 6,
                drilldown: 'january'
            },{
                name: 'July',
                y: 3,
                drilldown: 'july'
            },
            ],
        },
        {

            id: 'january',
            data: [['Dogs', 2],
                ['Cows', 1],
                ['Sheep', 2],
                ['Pigs', 1]]
        },{
        id: 'january',
            data: [['Dogs', 3],
                ['Cows', 1],
                ['Sheep', 2],
                ['Pigs', 1]]
        }]
    }
})
});

sorry, i forget to change the drilldown id for each year

drilldown: {
        series: [{
            id: '2017',
            name: '2017',
            data: [{
                name: 'January',
                y: 7,
                drilldown: '2017-january'
            },{
                name: 'July',
                y: 5,
                drilldown: '2017-july'
            },
            ],
        },
        {
            id: '2016',
            name: '2016',
            data: [{
                name: 'January',
                y: 6,
                drilldown: '2016-january'
            },{
                name: 'July',
                y: 3,
                drilldown: '2017-july'
            },
            ],
        },
        {

            id: '2017-january',
            data: [['Dogs', 2],
                ['Cows', 1],
                ['Sheep', 2],
                ['Pigs', 1]]
        },{
        id: '2016-january',
            data: [['Dogs', 3],
                ['Cows', 1],
                ['Sheep', 2],
                ['Pigs', 1]]
        }]
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM