From 473e57e22532f9b85fc9dcc1bcc53e12a10154c2 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 24 Jan 2010 20:44:17 -0800 Subject: bindRootId configuration option --- src/Filters.js | 51 ++++++++++++++++++++++++++------------------------- src/Parser.js | 2 +- src/Scope.js | 1 + 3 files changed, 28 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/Filters.js b/src/Filters.js index a0bedaaf..77fa5ec7 100644 --- a/src/Filters.js +++ b/src/Filters.js @@ -184,25 +184,25 @@ foreach({ function(type, data, width, height) { data = data || {}; var chart = { - cht:type, - chco:angularFilterGoogleChartApi.collect(data, 'color'), - chtt:angularFilterGoogleChartApi.title(data), - chdl:angularFilterGoogleChartApi.collect(data, 'label'), - chd:angularFilterGoogleChartApi.values(data), - chf:'bg,s,FFFFFF00' + 'cht':type, + 'chco':angularFilterGoogleChartApi['collect'](data, 'color'), + 'chtt':angularFilterGoogleChartApi['title'](data), + 'chdl':angularFilterGoogleChartApi['collect'](data, 'label'), + 'chd':angularFilterGoogleChartApi['values'](data), + 'chf':'bg,s,FFFFFF00' }; - if (_.isArray(data.xLabels)) { - chart.chxt='x'; - chart.chxl='0:|' + data.xLabels.join('|'); + if (_.isArray(data['xLabels'])) { + chart['chxt']='x'; + chart['chxl']='0:|' + data.xLabels.join('|'); } return angularFilterGoogleChartApi['encode'](chart, width, height); }, { 'values': function(data){ var seriesValues = []; - foreach(data.series||[], function(serie){ + foreach(data['series']||[], function(serie){ var values = []; - foreach(serie.values||[], function(value){ + foreach(serie['values']||[], function(value){ values.push(value); }); seriesValues.push(values.join(',')); @@ -213,7 +213,7 @@ foreach({ 'title': function(data){ var titles = []; - var title = data.title || []; + var title = data['title'] || []; foreach(_.isArray(title)?title:[title], function(text){ titles.push(encodeURIComponent(text)); }); @@ -223,7 +223,7 @@ foreach({ 'collect': function(data, key){ var outterValues = []; var count = 0; - foreach(data.series||[], function(serie){ + foreach(data['series']||[], function(serie){ var innerValues = []; var value = serie[key] || []; foreach(_.isArray(value)?value:[value], function(color){ @@ -240,7 +240,7 @@ foreach({ height = height || width; var url = "http://chart.apis.google.com/chart?"; var urlParam = []; - params.chs = width + "x" + height; + params['chs'] = width + "x" + height; foreach(params, function(value, key){ if (value) { urlParam.push(key + "=" + value); @@ -256,37 +256,38 @@ foreach({ 'qrcode': function(value, width, height) { - return angularFilterGoogleChartApi['encode']({cht:'qr', chl:encodeURIComponent(value)}, width, height); + return angularFilterGoogleChartApi['encode']({ + 'cht':'qr', 'chl':encodeURIComponent(value)}, width, height); }, 'chart': { - pie:function(data, width, height) { + 'pie':function(data, width, height) { return angularFilterGoogleChartApi('p', data, width, height); }, - pie3d:function(data, width, height) { + 'pie3d':function(data, width, height) { return angularFilterGoogleChartApi('p3', data, width, height); }, - pieConcentric:function(data, width, height) { + 'pieConcentric':function(data, width, height) { return angularFilterGoogleChartApi('pc', data, width, height); }, - barHorizontalStacked:function(data, width, height) { + 'barHorizontalStacked':function(data, width, height) { return angularFilterGoogleChartApi('bhs', data, width, height); }, - barHorizontalGrouped:function(data, width, height) { + 'barHorizontalGrouped':function(data, width, height) { return angularFilterGoogleChartApi('bhg', data, width, height); }, - barVerticalStacked:function(data, width, height) { + 'barVerticalStacked':function(data, width, height) { return angularFilterGoogleChartApi('bvs', data, width, height); }, - barVerticalGrouped:function(data, width, height) { + 'barVerticalGrouped':function(data, width, height) { return angularFilterGoogleChartApi('bvg', data, width, height); }, - line:function(data, width, height) { + 'line':function(data, width, height) { return angularFilterGoogleChartApi('lc', data, width, height); }, - sparkline:function(data, width, height) { + 'sparkline':function(data, width, height) { return angularFilterGoogleChartApi('ls', data, width, height); }, - scatter:function(data, width, height) { + 'scatter':function(data, width, height) { return angularFilterGoogleChartApi('s', data, width, height); } }, diff --git a/src/Parser.js b/src/Parser.js index d33ae3db..fe9671af 100644 --- a/src/Parser.js +++ b/src/Parser.js @@ -695,7 +695,7 @@ Parser.prototype = { self.scope.set(entity, Entity); if (instance) { var document = Entity(); - document.$$anchor = instance; + document['$$anchor'] = instance; self.scope.set(instance, document); return "$anchor." + instance + ":{" + instance + "=" + entity + ".load($anchor." + instance + ");" + diff --git a/src/Scope.js b/src/Scope.js index 9be6bc3f..7e477ec5 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -95,6 +95,7 @@ Scope.prototype = { }, eval: function(expressionText, context) { + log('Scope.eval', expressionText); var expression = Scope.expressionCache[expressionText]; if (!expression) { var parser = new Parser(expressionText); -- cgit v1.2.3