From c7e76d9b3f43204b1b48ccc7f2dc7fec754c767b Mon Sep 17 00:00:00 2001 From: Zhijie Wang Date: Mon, 1 Jun 2015 16:27:35 -0400 Subject: [PATCH 1/3] enabled download data as csv --- zeppelin-web/app/scripts/controllers/paragraph.js | 8 +++++++- zeppelin-web/app/views/paragraph.html | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/zeppelin-web/app/scripts/controllers/paragraph.js b/zeppelin-web/app/scripts/controllers/paragraph.js index bb8e19d984f..2b7fb3fd0bb 100644 --- a/zeppelin-web/app/scripts/controllers/paragraph.js +++ b/zeppelin-web/app/scripts/controllers/paragraph.js @@ -251,7 +251,13 @@ angular.module('zeppelinWebApp') $rootScope.$emit('sendNewEvent', data); }; + $scope.downloadParagraph = function(){ + var element = document.createElement('a'); + element.setAttribute('href', 'data:text/text;charset=utf-8,' + encodeURI($scope.paragraph.result.msg.replace(/\t/g,","))); + element.setAttribute('download', "data.csv"); + element.click(); + } $scope.runParagraph = function(data) { var parapgraphData = {op: 'RUN_PARAGRAPH', data: { @@ -912,11 +918,11 @@ angular.module('zeppelinWebApp') var chartEl = d3.select('#p'+$scope.paragraph.id+'_'+type+' svg') .attr('height', $scope.paragraph.config.graph.height) - .style('height', height + 'px') .datum(d3g) .transition() .duration(animationDuration) .call($scope.chart[type]); + d3.select('#p'+$scope.paragraph.id+'_'+type+' svg').style.height = height+'px'; nv.utils.windowResize($scope.chart[type].update); }; diff --git a/zeppelin-web/app/views/paragraph.html b/zeppelin-web/app/views/paragraph.html index ef4daaaee1b..75b9b5b9ee3 100644 --- a/zeppelin-web/app/views/paragraph.html +++ b/zeppelin-web/app/views/paragraph.html @@ -396,7 +396,9 @@ ng-click="toggleEditor()"> - + Date: Mon, 1 Jun 2015 21:51:37 -0400 Subject: [PATCH 2/3] up to date with master --- zeppelin-web/app/scripts/controllers/paragraph.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zeppelin-web/app/scripts/controllers/paragraph.js b/zeppelin-web/app/scripts/controllers/paragraph.js index 2b7fb3fd0bb..c06e4e8f610 100644 --- a/zeppelin-web/app/scripts/controllers/paragraph.js +++ b/zeppelin-web/app/scripts/controllers/paragraph.js @@ -915,8 +915,9 @@ angular.module('zeppelinWebApp') } } catch(ignoreErr) { } - var chartEl = d3.select('#p'+$scope.paragraph.id+'_'+type+' svg') + .attr('height', $scope.paragraph.config.graph.height) + .style('height', height + 'px') .attr('height', $scope.paragraph.config.graph.height) .datum(d3g) .transition() From cc799610a00f50dbb11d63f57564577d6e336710 Mon Sep 17 00:00:00 2001 From: Zhijie Wang Date: Mon, 1 Jun 2015 21:55:42 -0400 Subject: [PATCH 3/3] up to date with master --- zeppelin-web/app/scripts/controllers/paragraph.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/zeppelin-web/app/scripts/controllers/paragraph.js b/zeppelin-web/app/scripts/controllers/paragraph.js index c06e4e8f610..22d84296398 100644 --- a/zeppelin-web/app/scripts/controllers/paragraph.js +++ b/zeppelin-web/app/scripts/controllers/paragraph.js @@ -918,12 +918,10 @@ angular.module('zeppelinWebApp') var chartEl = d3.select('#p'+$scope.paragraph.id+'_'+type+' svg') .attr('height', $scope.paragraph.config.graph.height) .style('height', height + 'px') - .attr('height', $scope.paragraph.config.graph.height) .datum(d3g) .transition() .duration(animationDuration) .call($scope.chart[type]); - d3.select('#p'+$scope.paragraph.id+'_'+type+' svg').style.height = height+'px'; nv.utils.windowResize($scope.chart[type].update); };