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

时间:2015-11-07 04:45:02

标签: highcharts

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

但是,当更改为条形图时,yAxis上的标签从上到下依次为Don,Care,No,Yes。这个新订单对用户来说很奇怪。我希望在条形图中的yAxis上仍然保持Yes,No,Don&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 个答案:

答案 0 :(得分:1)

See the fiddle here

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