You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mi...@apache.org on 2017/03/17 03:22:33 UTC
[03/23] zeppelin git commit: [ZEPPELIN-1588]: bumping nvd3 to 1.8.5
[ZEPPELIN-1588]: bumping nvd3 to 1.8.5
### What is this PR for?
* bump nvd3 to 1.8.5 (and remove depecrated functions)
* display percentage in pie chart [solve ZEPPELIN-1891]
NB: visualization-scatterchart.js's tooltip content generator has been updated to stop using depecrated tooltip property and use tooltip.contentGenerator instead. However I have commented the code as I think nvd3 scatterchart's default tooltip is far more elegant, open to discussion.
### What type of PR is it?
Improvement
### Todos
* [ ] -
### What is the Jira issue?
* <https://issues.apache.org/jira/browse/ZEPPELIN-1588>
* <https://issues.apache.org/jira/browse/ZEPPELIN-1891>
### How should this be tested?
Visual testing of the builtin visualization.
### Screenshots (if appropriate)
PieChart display before PR:
![piechart-beforepr](https://cloud.githubusercontent.com/assets/8293897/23157700/830bda76-f81c-11e6-92fd-2a7f1a0d6f01.png)
PieChart display with PR:
![piechart-withpr](https://cloud.githubusercontent.com/assets/8293897/23157702/831fcc98-f81c-11e6-9f11-9b0f4bf010cc.png)
ScatterChart tooltip before PR:
![scatterchart-beforepr](https://cloud.githubusercontent.com/assets/8293897/23157699/830ae558-f81c-11e6-8528-85303804a339.png)
ScatterChart tooltip with PR:
![scatterchart-withpr](https://cloud.githubusercontent.com/assets/8293897/23157701/830cac3a-f81c-11e6-8029-73a7a30fe428.png)
### Questions:
* Does the licenses files need update? NO
* Is there breaking changes for older versions? NO
* Does this needs documentation? NO
Author: Remilito <re...@gmail.com>
Closes #2042 from Remilito/ZEPPELIN-1588 and squashes the following commits:
bbb0e9f [Remilito] removing tooltip.contentgenerator override
f0b3961 [Remilito] [ZEPPELIN-1588]: bumping nvd3 to 1.8.5 * remove deprecated calls * solve pie display pct * better tooltip for scatterchart
(cherry picked from commit e4d488b3a039f9565426156a3ec666799f0ade44)
Signed-off-by: ahyoungryu <ah...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/3779100b
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/3779100b
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/3779100b
Branch: refs/heads/branch-0.7
Commit: 3779100b6e48834d9d58cb91267b0c0084600907
Parents: a57a287
Author: Remilito <re...@gmail.com>
Authored: Tue Feb 21 09:47:42 2017 +0100
Committer: ahyoungryu <ah...@apache.org>
Committed: Sun Mar 5 16:23:45 2017 +0900
----------------------------------------------------------------------
zeppelin-web/bower.json | 2 +-
.../visualization/builtins/visualization-areachart.js | 2 +-
.../app/visualization/builtins/visualization-piechart.js | 7 ++++---
.../visualization/builtins/visualization-scatterchart.js | 11 -----------
4 files changed, 6 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/3779100b/zeppelin-web/bower.json
----------------------------------------------------------------------
diff --git a/zeppelin-web/bower.json b/zeppelin-web/bower.json
index 7c70110..7f292a9 100644
--- a/zeppelin-web/bower.json
+++ b/zeppelin-web/bower.json
@@ -17,7 +17,7 @@
"ace-builds": "1.2.6",
"angular-ui-ace": "0.1.3",
"jquery.scrollTo": "~1.4.13",
- "nvd3": "~1.7.1",
+ "nvd3": "~1.8.5",
"angular-dragdrop": "~1.0.8",
"perfect-scrollbar": "~0.5.4",
"ng-sortable": "~1.3.3",
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/3779100b/zeppelin-web/src/app/visualization/builtins/visualization-areachart.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/visualization/builtins/visualization-areachart.js b/zeppelin-web/src/app/visualization/builtins/visualization-areachart.js
index 719f3e3..25ed16f 100644
--- a/zeppelin-web/src/app/visualization/builtins/visualization-areachart.js
+++ b/zeppelin-web/src/app/visualization/builtins/visualization-areachart.js
@@ -60,7 +60,7 @@ export default class AreachartVisualization extends Nvd3ChartVisualization {
configureChart(chart) {
var self = this;
chart.xAxis.tickFormat(function(d) {return self.xAxisTickFormat(d, self.xLabels);});
- chart.yAxisTickFormat(function(d) {return self.yAxisTickFormat(d);});
+ chart.yAxis.tickFormat(function(d) {return self.yAxisTickFormat(d);});
chart.yAxis.axisLabelDistance(50);
chart.useInteractiveGuideline(true); // for better UX and performance issue. (https://github.com/novus/nvd3/issues/691)
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/3779100b/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js b/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js
index fdc67b1..8c8f8f2 100644
--- a/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js
+++ b/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js
@@ -21,7 +21,6 @@ import PivotTransformation from '../../tabledata/pivot';
export default class PiechartVisualization extends Nvd3ChartVisualization {
constructor(targetEl, config) {
super(targetEl, config);
-
this.pivot = new PivotTransformation(config);
};
@@ -43,7 +42,6 @@ export default class PiechartVisualization extends Nvd3ChartVisualization {
true,
false,
false);
-
var d = d3Data.d3g;
var d3g = [];
if (d.length > 0) {
@@ -67,6 +65,9 @@ export default class PiechartVisualization extends Nvd3ChartVisualization {
};
configureChart(chart) {
- chart.x(function(d) { return d.label;}).y(function(d) { return d.value;});
+ chart.x(function(d) { return d.label;})
+ .y(function(d) { return d.value;})
+ .showLabels(false)
+ .showTooltipPercent(true);
};
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/3779100b/zeppelin-web/src/app/visualization/builtins/visualization-scatterchart.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/visualization/builtins/visualization-scatterchart.js b/zeppelin-web/src/app/visualization/builtins/visualization-scatterchart.js
index 267693e..410c435 100644
--- a/zeppelin-web/src/app/visualization/builtins/visualization-scatterchart.js
+++ b/zeppelin-web/src/app/visualization/builtins/visualization-scatterchart.js
@@ -69,17 +69,6 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
chart.xAxis.tickFormat(function(d) {return self.xAxisTickFormat(d, self.xLabels);});
chart.yAxis.tickFormat(function(d) {return self.yAxisTickFormat(d, self.yLabels);});
- // configure how the tooltip looks.
- chart.tooltipContent(function(key, x, y, graph, data) {
- var tooltipContent = '<h3>' + key + '</h3>';
- if (self.config.size &&
- self.isValidSizeOption(self.config, self.tableData.rows)) {
- tooltipContent += '<p>' + data.point.size + '</p>';
- }
-
- return tooltipContent;
- });
-
chart.showDistX(true).showDistY(true);
//handle the problem of tooltip not showing when muliple points have same value.
};