Jquery Flot pie charts show data value instead of percentage

前端 未结 4 1808
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 05:09

I can\'t figure out how to get flot.pie to change the data shown in the labels from a percentage of the \"raw data\" to the actual data. In my example i\'ve created a pie chart

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 05:44

    You could use:

    formatter: function (label, series) {
        return '
    '+Math.round(series.percent)+"%
    " + series.data[0][1] +'
    '; },

提交回复
热议问题