1

我创建了一个饼图,并将这个饼图放在一个面板中。我的面板宽度可以是 600 或 400,具体取决于用户设置。当大小为 600 Pie 并且图例正确显示时。但是当它是 400 时,图例显示在面板之外。在这种情况下有没有办法减小饼图的大小,如果大小不够,图例也可以显示在底部。

我的 plnkr

https://plnkr.co/edit/yzXLz7AIDoWa1Pzxxl4k?p=preview

我的情节选项

 plotOptions: {
                pie: {

                    innerSize: 120,
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: false
                    },
                    showInLegend: true,
                    states: {
                      hover: {
                        halo: {
                          size: 0
                        }
                      }
                    }
                }
            },

响应代码:

响应:{

                    rules: [{
                            condition: {
                                maxWidth: 500
                            },
                            chartOptions: {
                                legend: {
                                    align: 'center',
                                    verticalAlign: 'top',
                                    layout: 'horizontal',
                                    labelFormatter: function () {
                                       return '<div style="width:180px"><span class="pull-left" style= "font-weight: 500; padding-bottom: 5px; font-family:Helvetica ">' + this.name +
                '</span><span class="pull-right" style= "font-weight: 500" >' + this.value +
                '</span></div> ';
                                    }
                                },
                                pie: {
                                    size: 100,
                                    innerSize: 40
                                }
                            }
                        }]
                }
4

0 回答 0