高图线系列不能正确显示堆叠条形组合图

HighCharts line series not displaying properly with stacked bar combo chart

本文关键字:组合图 显示 系列 不能 高图线      更新时间:2023-09-26

行系列不匹配

$(function () {
  $('#container').highcharts({
    title: {
        text: 'Combination chart'
    },
    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
    },
    labels: {
        items: [{
            html: 'Total fruit consumption',
            style: {
                left: '50px',
                top: '18px',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
            }
        }]
    },
    plotOptions: {
        series: {
            stacking: 'normal'
        }
    },
    series: [{
        type: 'column',
        name: 'Jane',
        data: [3, 2, 1, 3, 4],
        stack: 0
    }, {
        type: 'column',
        name: 'John',
        data: [2, 3, 5, 7, 6],
        stack: 0
    }, {
        type: 'column',
        name: 'Joe',
        data: [4, 3, 3, 9, 0],
        stack: 0
    }, {
        type: 'line',
        name: 'Average',
        data: [3, 2.67, 3, 6.33, 3.33],
        marker: {
            lineWidth: 2,
            lineColor: Highcharts.getOptions().colors[3],
            fillColor: 'white'
        }
    }, {
        type: 'line',
        name: 'Total consumption',
        data: [3, 2.67, 3, 6.33, 3.33],
        center: [100, 80],
        size: 100,
        showInLegend: false,
        dataLabels: {
            enabled: false
        }
    }]
  });
});

这里有一个小提琴来展示我在做什么:

http://jsfiddle.net/tn7b0fb0/

这一行的数字是相同的,为什么它们不在彼此的顶部?

如果你打开条形图,它看起来是正确的

从plotOptions中删除stacking: 'normal',并在序列级别上单独应用它,仅适用于列序列。

更新Jsfiddle