Formatting a pie chart legend

I've hunted high and low on this, but can't find a solution.

I'm looking to format the legend on a pie chart such that the names (25000,50000,100000) are formatted as $25,000, $50,000 etc.  For clarity, lets say that these are prices, and what we're trying to graph is the number of purchases at these prices, so the data would be something like

Price, Number Bought

25000, 4

50000, 7

100000, 3


I've managed this on the data labels using this:

SyntaxEditor Code Snippet

format: '$<b>{point.name:,.0f}</b>: {point.percentage:.1f} %'

but I can't format the legend in the same way.

SyntaxEditor Code Snippet

 legend: {
        align: 'right',
        verticalAlign: 'top',
        format: '${name:,.0f}'
    }

This will allow me to change the alignment and the vertical alignment, but the format is getting ignored.

Can anyone assist?

Hello Ian,


It seems that for Legends the correct parameter is labelFormat, have you tried it yet?


https://api.highcharts.com/highcharts/legend.labelFormat?_ga=2.175638626.1940625704.1556012239-808071389.1551178135

Jay Santos wrote:

Hello Ian,


It seems that for Legends the correct parameter is labelFormat, have you tried it yet?


https://api.highcharts.com/highcharts/legend.labelFormat?_ga=2.175638626.1940625704.1556012239-808071389.1551178135

Hi,

Yes - I tried that, and it doesn't work either.  The hunt continues.

Thanks anyway Jay.


Solution

I have just discovered the answer by chance.  It turns out that the Label is the legend when it comes to pie charts, so no AdvancedFormat is necessary, just a standard FormatCurrency() in the Label field of the SourceDataPointList/Label property.

Solution