You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/11/15 19:55:48 UTC
zeppelin git commit: [ZEPPELIN-1664] Built-in chart doesn't render
and resize height doesn't work
Repository: zeppelin
Updated Branches:
refs/heads/master 96ca84da1 -> 65667a34d
[ZEPPELIN-1664] Built-in chart doesn't render and resize height doesn't work
### What is this PR for?
Built-in chart doesn't render and resize height doesn't work
### What type of PR is it?
Hot fix
### Todos
* [x] - Fix problem
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1664
### How should this be tested?
run multiple times and see if graph is rendered correctly.
```
%spark
Thread.sleep(1000)
println(s"""%table key\tvalue\nsun\t50\nmoon\t20\n""")
```
try change height of paragraph and see if graph is updated
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no
Author: Lee moon soo <mo...@apache.org>
Closes #1641 from Leemoonsoo/ZEPPELIN-1664 and squashes the following commits:
6d1e2b6 [Lee moon soo] refresh graph when paragraph height change. render correctly after paragraph type change
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/65667a34
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/65667a34
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/65667a34
Branch: refs/heads/master
Commit: 65667a34d8289eb612a38381597d488cf88aa2c3
Parents: 96ca84d
Author: Lee moon soo <mo...@apache.org>
Authored: Tue Nov 15 11:14:01 2016 -0800
Committer: Lee moon soo <mo...@apache.org>
Committed: Tue Nov 15 11:55:35 2016 -0800
----------------------------------------------------------------------
.../notebook/paragraph/paragraph.controller.js | 25 +++++++++++++++++---
.../src/app/visualization/visualization.js | 8 ++-----
2 files changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/65667a34/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index efcd0d1..4443dbf 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -1054,11 +1054,30 @@
};
$timeout(retryRenderer);
} else if (refresh) {
+ console.log('Refresh data');
// when graph options or data are changed
- builtInViz.instance.setConfig($scope.paragraph.config.graph);
- builtInViz.instance.render(tableData);
+ var retryRenderer = function() {
+ var targetEl = angular.element('#p' + $scope.paragraph.id + '_' + type);
+ if (targetEl.length) {
+ targetEl.height(height);
+ builtInViz.instance.setConfig($scope.paragraph.config.graph);
+ builtInViz.instance.render(tableData);
+ } else {
+ $timeout(retryRenderer, 10);
+ }
+ };
+ $timeout(retryRenderer);
} else {
- builtInViz.instance.activate();
+ var retryRenderer = function() {
+ var targetEl = angular.element('#p' + $scope.paragraph.id + '_' + type);
+ if (targetEl.length) {
+ targetEl.height(height);
+ builtInViz.instance.activate();
+ } else {
+ $timeout(retryRenderer, 10);
+ }
+ };
+ $timeout(retryRenderer);
}
}
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/65667a34/zeppelin-web/src/app/visualization/visualization.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/visualization/visualization.js b/zeppelin-web/src/app/visualization/visualization.js
index e415b8a..33364e8 100644
--- a/zeppelin-web/src/app/visualization/visualization.js
+++ b/zeppelin-web/src/app/visualization/visualization.js
@@ -51,11 +51,8 @@ zeppelin.Visualization.prototype.refresh = function() {
* Activate. invoked when visualization is selected
*/
zeppelin.Visualization.prototype.activate = function() {
- console.log('active');
- if (!this._active && this._resized) {
- var self = this;
- // give some time for element ready
- setTimeout(function() {self.refresh();}, 300);
+ if (!this._active || this._resized) {
+ this.refresh();
this._resized = false;
}
this._active = true;
@@ -65,7 +62,6 @@ zeppelin.Visualization.prototype.activate = function() {
* Activate. invoked when visualization is de selected
*/
zeppelin.Visualization.prototype.deactivate = function() {
- console.log('deactive');
this._active = false;
};