Allow datalabel formatter to be over-riden with a string
Formatters on DataLabels on specific points must be a functions, this is limiting because I want to store the highcahrts object, as a big chunk of JSON in my DB. By changing line 12658 of highcharts.src.js from:
str = options.formatter.call(point.getLabelConfig(), options);
to
str = (typeof options.formatter === "string") ? options.formatter : options.formatter.call(point.getLabelConfig(), options);
I can store it as a whole and maintain the current functionality
Thanks,
Paul
It has been possible since Highcharts 2.3, but the option is called dataLabels.format: http://api.highcharts.com/highcharts#plotOptions.series.dataLabels.format
-
Alex Middeleer commented
This would be terrific. My use case is this: I generate the highcharts config file dynamically with PHP. I convert it to json so I can send an identical version to phantom or the client's browser based on whether the client has requested a pdf or HTML. The same chart appears on both sides, no duplication of code occurs anywhere. It's harder and riskier to send javascript via web-service, whereas json is trivial and well-supported. As things are now my choice is code duplication on the phantom server or an ugly workaround.