Highcharts,js柱形图不会显示负值

时间:2019-07-18 09:12:55

标签: highcharts

嗨,我正在尝试使柱形图显示负值。我看了很多例子,找不到解决方法。

我的代码如下所示:

/***************************************************************
 * container: chart_1_2
 ***************************************************************/
var chart_1_2_Options = {
    chart: {
        renderTo: 'chart_1_2',
        backgroundColor: '#FFFFFF',
        zoomType: 'x'
    },
    xAxis: {
        type: 'datetime'
    },
    plotOptions: {
        column: {
            borderWidth: 0
        },
        series: {
            pointWidth: 30,
            stacking: 'normal'
        }
    },
    legend: {
        enabled: true
    }
};

/**
 * initialize the chart
 */
var chart_1_2 = new Highcharts.Chart(chart_1_2_Options);
chart_1_2.showLoading();

/**
 * callback to be called from the bundled ajax calls
 */
function onChart_1_2_DataReceived(data) {
    console.log(data);
    /**
     * do something with the data
     */
    var seriesoptions = [
        {
            type: 'column',
            lineWidth: 2,
            states: {
                hover: {
                    enabled: true,
                    lineWidth: 2
                }
            },
            color: '#e25826',
            name: 'Sales'
        }
    ];

    chart_1_2_Options.series = seriesoptions;
    var chart_1_2 = new Highcharts.Chart(chart_1_2_Options);
    chart_1_2.series[0].setData(data);
}

/***************************************************************
 * end of chart_2_1
 **************************************************************/

传递给onChart_1_2_DataReceived()函数的数组如下:

array

如您所见,数组包含正值和负值,所有正值都显示在图表上,但所有负值都显示为0。

chart

我正在使用highcharts版本5.0.7。我尝试将yAxis min设置为-50,但这也没有任何区别。

0 个答案:

没有答案