From: Miosss Date: Wed, 9 Jul 2014 12:57:08 +0000 (+0200) Subject: Alternative scale templating. Passing function as template. X-Git-Tag: v1.0.1-beta.3~4^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c37c58ad39d8d1991065d0b7db561ab116afdd27;p=thirdparty%2FChart.js.git Alternative scale templating. Passing function as template. Allows to choose template mechanism - processing function or original micro templating. --- diff --git a/src/Chart.Core.js b/src/Chart.Core.js index 3484ae223..8a1c95bbe 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -402,6 +402,10 @@ //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 @@ -1886,4 +1890,4 @@ return Chart; }; -}).call(this); \ No newline at end of file +}).call(this);