如何在高图中使用Grouped类别插件时创建一个setCategory?

时间:2015-07-09 07:22:46

标签: highcharts

//Normal way of setting category
this.xAxis[0].setCategories(["category1", "category2"])

在为以下类别使用分组类别插件时,是否有类似的方法来设置类别?

    categories: [{
        name: "Actual",
        categories: ["Q1", "Q2", "Q3"]
    }, {
        name: "Forecast",
        categories: ["Q1", "Q2", "Q3"]
    }, {
        name: "Plan",
        categories: ["Q1", "Q2", "Q3"]
    }]

https://github.com/blacklabel/grouped_categories/

1 个答案:

答案 0 :(得分:2)

你可以这样做:

this.xAxis[0].setCategories(
    [{
        name: "Actual",
        categories: ["Q1", "Q2", "Q3"]
    }, {
        name: "Forecast",
        categories: ["Q1", "Q2", "Q3"]
    }, {
        name: "Plan",
        categories: ["Q1", "Q2", "Q3"]
    }]
);