首页 文章

Highcharts:条形图更改为柱形图时,如何保持类别标签的相同顺序

提问于
浏览
0

我有一个柱形图,在xAxis中有类别标签是,否,不在乎 . 我还有两个按钮,当点击时,它会变为条形图,反之亦然 . 看图:
enter image description here

但是,当更改为条形图时,yAxis上的标签从上到下依次为“不关心”,“否”,“是” . 这个新订单对用户来说很奇怪 . 我希望在条形图中的yAxis上仍然保持Yes,No,Do not care(从上到下) .

单击按钮时,我有以下代码更改为条形图:

var chart = code for find the chart object
    chart.inverted = true;
    chart.xAxis[0].update({}, false);
    chart.yAxis[0].update({}, false);
    chart.series[0].update({
        type: 'bar'
    });

以下代码用于更改为柱形图:

var chart = code for find the chart object
    chart.inverted = false;
    chart.xAxis[0].update({}, true);
    chart.yAxis[0].update({}, true);
    chart.series[0].update({
        type: 'column'
    });

如何在条形图中获得是,否 . 不关心(自上而下)订单?

谢谢!

1 回答

  • 1

    See the fiddle here

    $("#bar").click( function  (){
     var chart =  $('#container').highcharts();
     // Added code to share the fiddle
     });
    

相关问题