繁体   English   中英

高图边界周围情节

[英]Highcharts border around plot

因此,我正在尝试制作一个如下所示的图表:

所需图表

但我似乎无法让边界只包扎条。 这是我所能获得的最接近的:

实际图表

有人知道我该怎么做吗? 这是我的选择:

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'
    }
];
});

有很多事情需要改变以影响这一点。

工作example

我更新了什么:

  1. 您指定了plotOptions两次; 合并成一个以避免值冲突
  2. 从图表属性中删除了高度声明,并移至html元素
  3. 设置图表边距以强制减小绘图区域的大小,并为图例和导出菜单腾出空间
  4. 在xAxis上设置最小/最大加上minPadding / maxPadding
  5. 从图例中删除了“浮动”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM