javascript Highcharts 饼图动态改变大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23522769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 01:02:51  来源:igfitidea点击:

Highcharts pie chart dynamically changes size

javascriptchartshighchartspie-chart

提问by Water Monkey

I am having an issue with a pie chart I created in highcharts.

我在 highcharts 中创建的饼图有问题。

Depending on the placement of the data labels the actual chart will grow or shrink.

根据数据标签的位置,实际图表将增长或缩小。

We need the pie chart to stay the same size so is there a way to keep the pie size constant and force the labels to fit around it or do I just have to place the labels inside each slice?

我们需要饼图保持相同的大小,所以有没有办法保持饼图大小不变并强制标签适合它,或者我只需要将标签放在每个切片内?

回答by Sualkcin

You will have to set a fixed sizefor the pie chart. Can be a percentage or a pixel value. For example:

您必须size为饼图设置一个固定值。可以是百分比或像素值。例如:

plotOptions: {
        pie: {
            size: 100
        }
    },

See this fiddle from the API http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/pie-size/

从 API http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/pie-size/看到这个小提琴