Highcharts,在钻孔时添加“返回”(向上钻取)按钮

时间:2013-06-05 13:17:46

标签: jquery highcharts

如何实现'<返回此按钮http://jsfiddle.net/highcharts/Vf3yT/(点击饼图)到此http://jsfiddle.net/neFYY/(新的3.0 Highcharts)?

Highcharts.setOptions({
    lang: {
        drillUpText: '◁ Back to {series.name}'
    }
});

2 个答案:

答案 0 :(得分:3)

让我们说清楚:

因此,如果您想在第一个图表中使用插件,则需要为该插件传递适当的结构,即:

drilldown: {
    activeAxisLabelStyle: {
        cursor: 'pointer',
        color: '#039',
        fontWeight: 'bold',
        textDecoration: 'underline'            
    },
    activeDataLabelStyle: {
        cursor: 'pointer',
        color: '#039',
        fontWeight: 'bold',
        textDecoration: 'underline'            
    },
    animation: {
        duration: 500
    },
    series: [{
        id: 'fruits',
        name: 'Fruits',
        data: [
            ['Apples', 4],
            ['Pears', 6],
            ['Oranges', 2],
            ['Grapes', 8]
        ]
    }, {
        id: 'cars',
        name: 'Cars',
        data: [{
            name: 'Toyota', 
            y: 4,
            drilldown: 'toyota'
        },
        ['Volkswagen', 3],
        ['Opel', 5]
        ]
    }, {
        id: 'toyota',
        name: 'Toyota',
        data: [
            ['RAV4', 3],
            ['Corolla', 1],
            ['Carina', 4],
            ['Land Cruiser', 5]
        ]
    }]
},

系列:

series: [{
    name: 'Overview',
    colorByPoint: true,
    data: [{
        name: 'Fruits',
        y: 10,
        drilldown: 'fruits'
    }, {
        name: 'Cars',
        y: 12,
        drilldown: 'cars'
    }, {
        name: 'Countries',
        y: 8
    }]
}]

答案 1 :(得分:1)

我不确定问题出在哪里,要添加按钮,您可以使用plugin http://jsfiddle.net/Vf3yT/62

来自fisrt示例的顶部图表与第二个小提琴相同。