O0123
O0123

Reputation: 491

Semi-circle donut pie chart with labels (data names) and %-ages on the pie ... and data numbers on mousehover

The goal is to create a pie chart, where

Clarification: e.g. imagine a set consisting of 2 data labels. One is called apples (containing "15" apples), and the other one is called pears (containing "15" pears), then the percentages, always visible, shown inside the pie would be "50%" and "50%", whereas the data shown on mousehover would be "15" and "15".

Such has been already done in a previous post: Displaying percentage inside pie item for highcharts with JSFiddle 1.


However, would it be possible to

*Clarification: e.g. having the data labels "apples" and "pears" on the pie by default, such as "Firefox" and "Chrome" in Fiddle 2.*


Any help would be greatly appreciated, as I find it hard to combine these Fiddles, since I am far underexperienced with JS.

E.g. Fiddle 1 works/starts with $(function () { var chart = new Highcharts.Chart({,

whereas Fiddle 2 starts with $(function () { $('#container').highcharts({.

The Highcharts API Reference manual is learning me slowly, as a beginner.

Upvotes: 0

Views: 1900

Answers (1)

alacy
alacy

Reputation: 5064

Since I'm not sure which you prefer here is a fiddle you can look at that leverage the highcharts formatter attribute:

formatter: function() {
       return Math.round(this.percentage*100)/100 + ' %';
}

I believe what you want is something like this.

Upvotes: 2

Related Questions