深入分组列级别

时间:2016-06-16 18:02:24

标签: jquery json highcharts

这是我的小提琴:http://jsfiddle.net/6LXVQ/1223/

我希望能够做的是向下钻取到第二级,该级别也是分组列。现在,如果您钻入任何顶级列,您将在第二级获得单列。有什么想法吗?

我目前的代码:

$(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': 'ROI',
        'data': [{
          "name": "USA",
          "level": 1,
          "parent": "",
          "y": 0.629820585402,
          "drilldown": "12000"
        }]
      }, {
        'name': 'BOI',
        'data': [{
          "name": "USA",
          "level": 1,
          "parent": "",
          "y": 3.29620816518,
          "drilldown": "12000"
        }]
      }],
      drilldown: {
        series: [{
            "id": "12000",
            "name": "USA",
            "data": [{
              "name": "a",
              "level": 2,
              "parent": "12000",
              "y": null,
              "drilldown": "12400"
            }, {
              "name": "b",
              "level": 2,
              "parent": "12000",
              "y": null,
              "drilldown": "12300"
            }, {
              "name": "c",
              "level": 2,
              "parent": "12000",
              "y": 1,
              "drilldown": "12200"
            }, {
              "name": "d",
              "level": 2,
              "parent": "12000",
              "y": null,
              "drilldown": "12500"
            }, {
              "name": "e",
              "level": 2,
              "parent": "12000",
              "y": 4,
              "drilldown": "12100"
            }, {
              "name": "f",
              "level": 2,
              "parent": "12000",
              "y": null,
              "drilldown": "12600"
            }]
          }, {
            "id": "12400",
            "name": "a",
            "data": [{
              "name": "g",
              "level": 3,
              "parent": "12400",
              "y": [1, 2],
              "drilldown": "12410"
            }, {
              "name": "h",
              "level": 3,
              "parent": "12400",
              "y": [2, 3],
              "drilldown": "12430"
            }, {
              "name": "i",
              "level": 3,
              "parent": "12400",
              "y": [1, 2],
              "drilldown": "12420"
            }, {
              "name": "j",
              "level": 3,
              "parent": "12400",
              "y": [2, 3],
              "drilldown": "12410"
            }, {
              "name": "k",
              "level": 3,
              "parent": "12400",
              "y": null,
              "drilldown": "12430"
            }, {
              "name": "l",
              "level": 3,
              "parent": "12400",
              "y": null,
              "drilldown": "12420"
            }]
          }, {
            "id": "12300",
            "name": "b",
            "data": [{
              "name": "m",
              "level": 3,
              "parent": "12300",
              "y": null,
              "drilldown": "12310"
            }, {
              "name": "n",
              "level": 3,
              "parent": "12300",
              "y": null,
              "drilldown": "12310"
            }]
          }, {
            "id": "12200",
            "name": "c",
            "data": [{
              "name": "o",
              "level": 3,
              "parent": "12200",
              "y": null,
              "drilldown": "12220"
            }, {
              "name": "p",
              "level": 3,
              "parent": "12200",
              "y": 0.757404909208,
              "drilldown": "12210"
            }, {
              "name": "q",
              "level": 3,
              "parent": "12200",
              "y": null,
              "drilldown": "12230"
            }, {
              "name": "r",
              "level": 3,
              "parent": "12200",
              "y": null,
              "drilldown": "12220"
            }, {
              "name": "w",
              "level": 3,
              "parent": "12200",
              "y": 0.757404909208,
              "drilldown": "12210"
            }, {
              "name": "t",
              "level": 3,
              "parent": "12200",
              "y": null,
              "drilldown": "12230"
            }]
          }, {
            "id": "12500",
            "name": "d",
            "data": [{
              "name": "v",
              "level": 3,
              "parent": "12500",
              "y": null,
              "drilldown": "12510"
            }, {
              "name": "w",
              "level": 3,
              "parent": "12500",
              "y": null,
              "drilldown": "12510"
            }]
          }]
        }
      })
  });

0 个答案:

没有答案