0

嗨,我目前正在开发一个带有 3 级向下钻取的柱状高图表,但是我很难命名图例,我希望图例显示数据名称,但它目前仅显示系列名称。

我也很烦恼传说随着它通过不同的层次而适当地改变。

http://jsfiddle.net/amccormack10/tdy2x4dp/1/

 $(function () {

    // Create the chart
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Number of Students Enrolled & Withdrawn'
        },
        subtitle: {
            text: 'Click the Columns to see Totals for each Level'
        },
        xAxis: {
            type: 'category',


            title: {
                text: 'Students'
            }
        },
        yAxis: {
            title: {
                text: 'Total Number of Students'
            }
        },

        legend: {
            enabled: true
            //backgroundColor: '#FFFFFF',
            //layout: 'vertical',
            //floating: true,
            //align: 'left',
            //verticalAlign: 'top',
            //x: 90,
            //y: 60,
            //shadow: true

        },



        series: [{
            name: 'Overall Total of Students',
            colorByPoint: true,
            data: [{
                name: 'Enrolled',
                y: 44,
                drilldown: 'LevelEnrolled'

            }, {
                name: 'Withdrawn',
                y: 55,
                drilldown: 'LevelWithdrawn'
            }]

        }],



        drilldown: {


            series: [{
                name: 'Enrolled by Level',
                colorByPoint: true,
                id: 'LevelEnrolled',
                data: [{
                    name: 'Level 1',
                    y: 23,
                    drilldown: 'Level1Enrolled'
                }, {
                    name: 'Level 2',
                    y: 24,
                    drilldown: 'Level2Enrolled'
                }, {
                    name: 'Level 3',
                    y: 11,
                    drilldown: 'Level3Enrolled'
                }]
            }, {
                name: 'Withdrawn by Level',
                colorByPoint: true,
                id: 'LevelWithdrawn',
                data: [{
                    name: 'Level 1',
                    y: 12,
                    drilldown: 'Level1Withdrawn'
                }, {
                    name: 'Level 2',
                    y: 33,
                    drilldown: 'Level2Withdrawn'
                }, {
                    name: 'Level 3',
                    y: 33,
                    drilldown: 'Level3Withdrawn'
                }]
            }, {
                id: 'Level1Enrolled',
                colorByPoint: true,
                data: [
                    ['CIT', 22],
                    ['CS', 11],
                    ['GD', 33],
                    ['SD', 12],
                    ['BIT', 34]
                ]
            }, {
                id: 'Level2Enrolled',
                colorByPoint: true,
                data: [
                    ['CIT', 43],
                    ['CS', 22],
                    ['GD', 33],
                    ['SD', 22],
                    ['BIT', 22]
                ]
            }, {
                id: 'Level3Enrolled',
                colorByPoint: true,
                data: [
                    ['CIT', 22],
                    ['CS', 22],
                    ['GD', 12],
                    ['SD', 11],
                    ['BIT', 23]
                ]
            }, {
                id: 'Level1Withdrawn',
                colorByPoint: true,
                data: [
                    ['CIT', 23],
                    ['CS', 11],
                    ['GD', 2],
                    ['SD', 1]
                ]
            }, {
                id: 'Level2Withdrawn',
                colorByPoint: true,
                data: [
                    ['CIT', 3],
                    ['CS', 2],
                    ['GD', 4],
                    ['SD', 7]
                ]
            }, {
                id: 'Level3Withdrawn',
                colorByPoint: true,
                data: [
                    ['CIT', 3],
                    ['CS', 4],
                    ['GD', 5],
                    ['SD', 8]
                ]

            }]


        }
    });
});

任何帮助将不胜感激。

谢谢

4

0 回答 0