Data label not showing in some pie chart handles Highchart

故事扮演 提交于 2021-01-29 10:49:54

问题


I am having a weird a problem in highchart piechart.

If the number of points are more than 6 and if one of them having a less percentage of 1.2% the lesser point won't show data labels.

I am not sure whether it is the exact scenario.

This is my javascript file

    Highcharts.chart('container', {
    chart: {
        type: 'pie'
    },
    series: [{
        name: 'Brands',
        data: [
        {name: "Nike", y: 91.6},
        {name: "Adidas", y: 2.2},
        {name: "Puma", y: 2.0},
        {name: "Skechers", y: 1.6},
        {name: "North face", y: 1.4},
        {name: "Asics", y: 1.2},
    ],
    }],
});

And This is my jsfiddle

Can any one please help me to solve this?


回答1:


By setting series.dataLabels.padding : 0 you can show all labels like that:

series: [{
  name: 'Brands',
  dataLabels: {
    padding: 0
  },
  data: [{
      name: "Nike",
      y: 91.6
    },
    {
      name: "Adidas",
      y: 0.2
    },
    {
      name: "Puma",
      y: 0.2
    },
    {
      name: "Skechers",
      y: 1.6
    },
    {
      name: "North face",
      y: 0.2
    },
    {
      name: "Asics",
      y: 0.2
    },
  ]
}]

Fiddle



来源:https://stackoverflow.com/questions/56672874/data-label-not-showing-in-some-pie-chart-handles-highchart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!