图例位于底部,带有 highcharts

wn9m85ua  于 2022-11-10  发布在  Highcharts
关注(0)|答案(2)|浏览(228)

我使用highcharts来绘制一些图表。我使用的基本线图是这样的:
http://www.highcharts.com/demo/spline-irregular-time
如何将图例显示在图表区下方而不是右侧?
http://www.highcharts.com/demo/column-stacked-percent
谢谢

cunj1qz1

cunj1qz11#

marginBottom可以用来将图例放在图表的底部。您仍然可以使用legend属性来移动图例,例如在中间或右边(我使用了center)。

chart: {
        marginBottom: 100
    },

    legend: {
        align: 'center',
        verticalAlign: 'bottom',
        x: 0,
        y: 0
    },

可能的解决方案:fiddle

v9tzhpje

v9tzhpje2#

默认情况下,图例位于图表下方,因此您可以完全省略legend属性。请记住,为了使其看起来更美观,您必须在下边距中添加一点内容,否则图表和图例会重叠。

chart: {
    type: 'line',
    marginRight: 130,
    marginBottom: 70 // Increase this to 70 or so
},
// Remove the legend property completely

Here's a demonstration

相关问题