Skip to content

Commit

Permalink
0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jtblin committed Aug 30, 2015
1 parent 31be999 commit 6729325
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 80 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-chart.js",
"version": "0.7.6",
"version": "0.8.0",
"main": [
"./dist/angular-chart.js",
"./dist/angular-chart.css"
Expand Down
49 changes: 43 additions & 6 deletions dist/angular-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,25 @@
return {
restrict: 'CA',
scope: {
data: '=',
labels: '=',
options: '=',
series: '=',
data: '=?',
labels: '=?',
options: '=?',
series: '=?',
colours: '=?',
getColour: '=?',
chartType: '=',
legend: '@',
click: '=',
hover: '='
click: '=?',
hover: '=?',

chartData: '=?',
chartLabels: '=?',
chartOptions: '=?',
chartSeries: '=?',
chartColours: '=?',
chartLegend: '@',
chartClick: '=?',
chartHover: '=?'
},
link: function (scope, elem/*, attrs */) {
var chart, container = document.createElement('div');
Expand All @@ -105,6 +114,24 @@

if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);

['data', 'labels', 'options', 'series', 'colours', 'legend', 'click', 'hover'].forEach(deprecated);
function aliasVar (fromName, toName) {
scope.$watch(fromName, function (newVal) {
if (typeof newVal === 'undefined') return;
scope[toName] = newVal;
});
}
/* provide backward compatibility to "old" directive names, by
* having an alias point from the new names to the old names. */
aliasVar('chartData', 'data');
aliasVar('chartLabels', 'labels');
aliasVar('chartOptions', 'options');
aliasVar('chartSeries', 'series');
aliasVar('chartColours', 'colours');
aliasVar('chartLegend', 'legend');
aliasVar('chartClick', 'click');
aliasVar('chartHover', 'hover');

// Order of setting "watch" matter

scope.$watch('data', function (newVal, oldVal) {
Expand Down Expand Up @@ -172,6 +199,16 @@
});
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}

function deprecated (attr) {
if (typeof console !== 'undefined' && ChartJs.getOptions().env !== 'test') {
var warn = typeof console.warn === 'function' ? console.warn : console.log;
if (!! scope[attr]) {
warn.call(console, '"%s" is deprecated and will be removed in a future version. ' +
'Please use "chart-%s" instead.', attr, attr);
}
}
}
}
};
};
Expand Down
Binary file modified dist/angular-chart.js.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/angular-chart.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-chart.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 6729325

Please sign in to comment.