如何更改此下拉饼图上的后退按钮文本?

时间:2015-06-29 14:59:15

标签: javascript highcharts

当您点击“再生材料”时,饼图的一部分下拉到有关该部分的更多信息。

问题是后退按钮有默认文字'返回品牌'在其中,我无法在我的代码中找到任何地方来改变它。

我的代码如下:

爪哇:

 $(function () {
// Create the chart
$('#container').highcharts({
    credits: {
        enabled: false
    },
    chart: {
plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
        type: 'pie'
    },
    title: {
        text: 'Green Up Amount Recycled'
    },
    subtitle: {
        text: 'Click the Recycled Materials slice for more information.'
    },
   plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: false
                },
                showInLegend: true
            }
        },
    tooltip: {
        headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
        pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'
    },
    series: [{
        name: "Brands",
        colorByPoint: true,
        data: [{
            name: "Landfill - 45,821 lbs",
            y: 23.73,
        }, {
            name: "Recycled Materials - 147,276 lbs",
            y: 76.27,
            drilldown: "Recycled Materials"
        }]
    }],
    drilldown: {
        series: [{
            name: "Recycled Materials",
            id: "Recycled Materials",
            data: [
                ["Tent Frames and Chairs - 6,400 lbs", 4.35],
                ["Aluminum Cans - 28,950 lbs", 19.66],
                ["Plastic PET Bottles - 36,420 lbs", 24.73],
                ["Glass - 40,950 lbs", 27.8],
                ["Cardboard - 30,000 lbs", 20.37],
                ["Solo Cups - 4,556 lbs", 3.09],
            ]
        }]
    }
});
});

HTML:

    <script src="http://code.highcharts.com/highcharts.js"></script>
    <script src="http://code.highcharts.com/modules/exporting.js"></script>
    <script src="http://code.highcharts.com/modules/data.js"></script>
    <script src="http://code.highcharts.com/modules/drilldown.js"></script>
<div id="container" style="min-width: 500px; max-width: 500px; height: 400px; margin: 0 auto"></div>

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

只需更改

name: "Brands"

任何你拥有的东西,也许是“材料”,example