1

I have created a Pie chart and I am placing this Pie chart inside a panel. My panel width can be 600 or 400 depending on the user settings. When the size is 600 Pie and the legend is displayed properly. But when it is 400, the legend is displayed outside of the panel. Is there a way to reduce the size of the pie in that case, also the legend can be displayed at the bottom if the size is not sufficient.

My plnkr

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

My plot options

 plotOptions: {
                pie: {

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

Response code:

responsive: {

                    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
                                }
                            }
                        }]
                }
indra257
  • 66
  • 3
  • 24
  • 50
  • 1
    Have you seen Highcharts responsive rules? https://www.highcharts.com/demo/responsive – stpoa Apr 25 '17 at 14:22
  • Yes and I already tried that, added my response code to the question.But now the legend is appearing above the chart. – indra257 Apr 25 '17 at 18:33
  • It is because you set verticalAlign to top - set it to bottom instead https://plnkr.co/edit/x8v6dY2wQgT7VdWUBGSK?p=preview – morganfree Apr 26 '17 at 19:25

0 Answers0