Highcharts边境情节

jen*_*gar 1 jquery highcharts

所以我试图制作一个如下所示的高清图:

期望的图表

但我似乎无法让边界只包裹酒吧.这是我能得到的最接近的:

实际图表

有谁知道我怎么做到这一点?以下是我的选择:

highcharts({
chart: {
    backgroundColor: 'transparent',
    plotBorderColor: '#9E9E9E',
    plotBorderWidth: 2,
    height: 200,
    type: 'bar'
},
title: {
    text: null
},
credits: {
    enabled: false
},
yAxis: {
    title: {
        text: null
    },
    labels: {
        enabled: false
    },
    tickLength: 0,
    lineColor: 0,
    lineWidth: 0,
    gridLineWidth: 0
},
xAxis: {
    title: {
        text: null
    },
    labels: {
        enabled: false
    },
    tickLength: 0,
    lineColor: 0,
    lineWidth: 0
},
plotOptions: {
    bar: {
        borderColor: '#000000'
    }
},
legend: {
    // reversed: true,
    symbolHeight: 0,
    symbolWidth: 0,
    floating: true,
    useHTML: true,
    itemDistance: 10,
    y: -10,
    labelFormatter:
        function() {
            if (this.name === "HIDDEN")
            {
                return '';
            }
            return '<div class="insp360-widgetLegendItemContainer">' +
                    '<div class="insp360-widgetLegendNumber" style="background-color: ' + this.color + '">' + this.yData[0] + '</div>' +
                    '<div class="insp360-widgetLegendName">' + this.name + '</div>' +
                '</div>';
        }
},
plotOptions: {
    series: {
        stacking: 'percent',
        pointWidth: 50
    }
},
series: [
    {
        name: 'New Business',
        data: [chartData['New Business'] || 0],
        color: '#ADD8E6'
    },
    {
        name: 'Re-Underwriting',
        data: [chartData['Re-Underwriting'] || 0],
        color: '#FFBC57'
    },
    {
        name: 'Consultative Visit',
        data: [chartData['Consultative Visit'] || 0],
        color: '#FF5200'
    },
    {
        name: 'Recommendation Check',
        data: [chartData['Recommendation Check'] || 0],
        color: '#B084FF '
    },
    {
        name: 'Other',
        data: [chartData['Other'] || 0],
        color: '#27AC4C'
    }
];
});
Run Code Online (Sandbox Code Playgroud)

jlb*_*ggs 5

有许多事情要改变以影响这一点.

工作example:

我更新了什么:

  1. 你有两次plotOptions; 合并为一个以避免相互冲突的价值观
  2. 从图表属性中删除了高度声明并移动到html元素
  3. 设置图表边距以强制绘图区域的大小,并为图例和导出菜单腾出空间
  4. 在xAxis上设置min/max加上minPadding/maxPadding
  5. 从传奇中移除'浮动'