简体   繁体   English

高图:在同一容器中对齐多个图表

[英]Highcharts: Align multiple charts in same container

Following this demo here ( http://www.highcharts.com/docs/chart-and-series-types/combining-chart-types ) I am trying to have a Pie chart and a bar chart on the same page. 在此演示之后( http://www.highcharts.com/docs/chart-and-series-types/combining-chart-types ),我试图在同一页面上使用饼图和条形图。

The catch is I would like the Pie chart to be large on the left and then the bar chart on the right. 我要抓住的是,我希望饼图在左侧变大,然后在条形图在右侧。 I see the code to move the pie chart around, but I cannot figure out how to do the same with the bar chart, as it seems to want to span the entire container width. 我看到了移动饼图的代码,但是我无法弄清楚如何对条形图进行操作,因为它似乎想跨越整个容器宽度。 I understand that I could have two independent charts and place them in their own floating DIVs, but since the combining of charts is possible, I thought this would be a viable option. 我知道我可以有两个独立的图表并将它们放置在自己的浮动DIV中,但是由于可以合并图表,因此我认为这是一个可行的选择。

You can set chart.marginLeft to half of the chart width. 您可以将chart.marginLeft设置为图表宽度的一半。 And set pie.center x coordinate to a negative value. 并将pie.center x坐标设置为负值。

chart: {
   marginLeft: 400
},

series: [{
   center: ['-75%', '50%'],

example: http://jsfiddle.net/L55w9n53/ 例如: http//jsfiddle.net/L55w9n53/

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

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