Skip to content

Commit

Permalink
Issue-151 Update to support the new nvd3 v1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
NameFILIP committed Jun 29, 2015
1 parent bcedcd0 commit 88019bd
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 55 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
},
"dependencies": {
"angular": "^1.x",
"d3": "~3.3.13",
"nvd3": "~1.7.1"
"d3": "^3.3.13",
"nvd3": "^1.7.1"
},
"ignore": [
"**/.*",
Expand Down
79 changes: 42 additions & 37 deletions dist/angular-nvd3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**************************************************************************
* AngularJS-nvD3, v1.0.0-rc; MIT License; 29/06/2015 11:23
* AngularJS-nvD3, v1.0.0-rc; MIT License; 29/06/2015 15:12
* http://krispo.github.io/angular-nvd3
**************************************************************************/
(function(){
Expand Down Expand Up @@ -62,14 +62,14 @@
scope.chart.id = Math.random().toString(36).substr(2, 15);

angular.forEach(scope.chart, function(value, key){
if ([
'options',
'_options',
'_inherited',
'_d3options',
'state',
if (key[0] === '_');
else if ([
'clearHighlights',
'highlightPoint',
'id',
'resizeHandler'
'options',
'resizeHandler',
'state'
].indexOf(key) >= 0);

else if (key === 'dispatch') {
Expand All @@ -80,34 +80,37 @@
}

else if ([
'lines',
'lines1',
'lines2',
'bars',
'bars1',
'bars2',
'stack1',
'stack2',
'multibar',
'boxplot',
'bullet',
'controls',
'discretebar',
'distX',
'distY',
'interactiveLayer',
'legend',
'lines',
'lines1',
'lines2',
'multibar',
'pie',
'scatter',
'bullet',
'sparkline',
'legend',
'distX',
'distY',
'xAxis',
'stack1',
'stack2',
'sunburst',
'tooltip',
'x2Axis',
'yAxis',
'yAxis1',
'yAxis2',
'xAxis',
'y1Axis',
'y2Axis',
'y3Axis',
'y4Axis',
'interactiveLayer',
'controls'
'yAxis',
'yAxis1',
'yAxis2'
].indexOf(key) >= 0 ||
// stacked is a component for stackedAreaChart, but a boolean for multiBarChart and multiBarHorizontalChart
(key === 'stacked' && options.chart.type === 'stackedAreaChart')) {
Expand Down Expand Up @@ -172,17 +175,19 @@
element.find('.subtitle').remove();
element.find('.caption').remove();
element.empty();
if (scope.chart) {
// remove chart from nv.graph list

// To be compatible with old nvd3 (v1.7.1)
if (nv.graphs && scope.chart) {
for(var i = nv.graphs.length - 1; i >= 0; i--) {
if(nv.graphs[i].id === scope.chart.id) {
nv.graphs.splice(i, 1);
}
}
scope.chart = null;
}

nv.tooltip.cleanup();
if (nv.tooltip && nv.tooltip.cleanup) {
nv.tooltip.cleanup();
}
scope.chart = null;
},

// Get full directive scope
Expand All @@ -193,24 +198,24 @@
function configure(chart, options, chartType){
if (chart && options){
angular.forEach(chart, function(value, key){
if (key === 'dispatch') {
if (key[0] === '_');
else if (key === 'dispatch') {
if (options[key] === undefined || options[key] === null) {
if (scope._config.extended) options[key] = {};
}
configureEvents(value, options[key]);
}
else if ([
'scatter',
'axis',
'clearHighlights',
'defined',
'highlightPoint',
'nvPointerEventsClass',
'options',
'axis',
'rangeBand',
'rangeBands',
'_options',
'_inherited',
'_d3options',
'_calls'
].indexOf(key) < 0){
'scatter'
].indexOf(key) === -1) {
if (options[key] === undefined || options[key] === null){
if (scope._config.extended) options[key] = value();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-nvd3.min.js

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

Loading

0 comments on commit 88019bd

Please sign in to comment.