移动Highcharts Legend复选框

时间:2014-06-05 17:02:55

标签: highcharts highstock

我启用了Highcharts Legend上的复选框。我还禁用了标签的点击以在图表中切换该项目。这样就可以使用复选框来切换图形项目。现在的问题是复选框始终位于标签的末尾(最右侧)。有没有办法让它出现在标签的左侧?如果不是,我只想将标签分开,这样它们就不会彼此相邻。当我这样做时,复选框保持在最右侧。这使它看起来与图例中的下一个项目配对。如果我们可以让复选框保留在标签右侧,那也没关系。以下是我到目前为止的情况:

$(function() {
$('#container').highcharts({

    chart: {
        renderTo: 'container',
        defaultSeriesType: 'column'
    },
    title: {
        text: 'Placed By Advisor'
    },
    xAxis: {
        categories: ['John Jenkins', 'Steve Smith', 'Will Douglas', 'Dustin Johnson', 'Suzy Abbott', 'Wendy Jones'],
        min: 0,
        max: 4

    },
    yAxis: {
        min: 0
    },
    legend: {
        shadow: true,
        itemHoverStyle: {
            cursor: "default"
        },
        itemDistance: 50
        //title: {
          //  text: '<span style="font-size: 10px; color: #666; font-weight: normal">Click to hide</span>',
            //    style: {
              //      fontStyle: 'italic'
               // }
            //},
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0.5
        },
        series: {
            showCheckbox: true,
            events: {
                checkboxClick: function (event) {
                    if (event.checked) {
                        this.show();
                        this.legendSymbol.show();
                    } else {
                        this.hide();
                        this.legendSymbol.hide();
                    }
                },
                legendItemClick: function() {
                    return false;
                }
            }
        }
    },
    series: [{
        name: 'Unemployed',
        color: '#D70014',
        selected: true,
        data: [100, 100, 120, 55, 35, 189]},
    {
        name: 'Placed In Related',
        color: '#6CBA16',
        selected: true,
        data: [80, 108, 15, 74, 48, 88]},
    {
        name: 'Placed In Unrelated',
        color: '#FFA501',
        selected: true,
        data: [17, 22, 187, 70, 75, 35]},
    {
        name: 'Except',
        color: '#2F7DC4',
        selected: true,
        data: [10, 0, 19, 65, 25, 674]}],

    scrollbar: {
        enabled:true,
        barBackgroundColor: 'lightgray',
        //barBorderRadius: 7,
        //barBorderWidth: 0,
        //buttonBackgroundColor: 'gray',
        //buttonBorderWidth: 0,
        //buttonArrowColor: 'yellow',
        //buttonBorderRadius: 0,
        //rifleColor: 'yellow',
        //trackBackgroundColor: 'red',
        //trackBorderWidth: 1,
        //trackBorderColor: 'silver',
        //trackBorderRadius: 7
    }
});

});

这是fiddle.

0 个答案:

没有答案