]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Alternative scale templating. Passing function as template.
authorMiosss <Miosss@users.noreply.github.com>
Wed, 9 Jul 2014 12:57:08 +0000 (14:57 +0200)
committerMiosss <Miosss@users.noreply.github.com>
Wed, 9 Jul 2014 12:57:08 +0000 (14:57 +0200)
Allows to choose template mechanism - processing function or original micro templating.

src/Chart.Core.js

index 3484ae22354019c43bba9a7425efb60ef51abd93..8a1c95bbe440d536571d6d0580eeb823a5c62d35 100755 (executable)
                //Templating methods
                //Javascript micro templating by John Resig - source at http://ejohn.org/blog/javascript-micro-templating/
                template = helpers.template = function(templateString, valuesObject){
+                        // If templateString is function rather than string-template - call the function for valuesObject
+                        if(templateString instanceof Function)
+                               return templateString(valuesObject);
+                        
                        var cache = {};
                        function tmpl(str, data){
                                // Figure out if we're getting a template, or if we need to
                return Chart;
        };
 
-}).call(this);
\ No newline at end of file
+}).call(this);