HireIQ / highcharts-python

Python Config Generation for Python
12 stars 10 forks source link

formatter keyword support #2

Open bigbes opened 11 years ago

bigbes commented 11 years ago

You have no formatter argument support in TooltipConfig, and it seems to me that embedding JS code into python JSON won't be the easiest thing to do..

e.g.

        tooltip: {
            formatter: function() {
                var s = '<b>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.x) +'</b>';
                $.each(this.points, function(i, point) {
                    s += '<br/>1 USD = '+ point.y +' EUR';
                });

                return s;
            }
        },

which we can't do, because of we can't print string (function) without quotes.

'<b>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.x) +'</b>';
                $.each(this.points, function(i, point) {
                    s += '<br/>1 USD = '+ point.y +' EUR';
                });

What can we do with it? I'm sorry for my poor English.

bigbes commented 11 years ago

It comes to me, that we can do such things as recreating value:

if (config.tooltip && config.tooltip.formatter){
    config.tooltip.formatter = Function(config.tooltip.formatter);
}

from JS script.