简体   繁体   English

高图对齐多个饼图

[英]Highcharts align multiple piecharts

I made 2 pie charts using Highcharts from different data. 我使用Highcharts从不同数据制作了2个饼图。

So they have different number of data as well as legends. 因此,它们具有不同数量的数据以及图例。

But I want to align them properly so chart by chart, legend by legend. 但是我想适当地调整它们,以便逐个图表,逐个图例。

How can I do this? 我怎样才能做到这一点?

I tried to set max-height of pie chart legends but that not works. 我试图设置饼图图例的最大高度 ,但这不起作用。 在此处输入图片说明

Any help would be appreciated. 任何帮助,将不胜感激。

You will need to use the chart.spacingBottom and chart.spacingTop ( API Documentation ) to create the same space on both charts like this : 您将需要使用chart.spacingBottomchart.spacingTopAPI文档 )在两个图表上创建相同的空间,如下所示:

chart: {
  spacingTop:15,
  spacingBottom:18
},

Fiddle 小提琴

With vertical legend layout it will be better to use margin property: 使用vertical图例布局,最好使用margin属性:

chart: {
    type: 'pie',
    marginBottom: 80
},

Live demo: https://jsfiddle.net/BlackLabel/a62ztm5o/ 现场演示: https : //jsfiddle.net/BlackLabel/a62ztm5o/

API: https://api.highcharts.com/highcharts/chart.marginBottom API: https //api.highcharts.com/highcharts/chart.marginBottom

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

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