[ZEPPELIN-2253] Piechart won't render when column selected as 'key' is changed
### What is this PR for? * Fixes issue with pie chart rendering, if user changes pie chart's domain * When pie chart's key(domain) is changed, this error is logged: 'Uncaught TypeError: arcs[idx] is not a function at pie.js:358' * Even if user changes the key and values again, chart remains broken * Fix: set this.chart to null, which makes render function to initialize new pie chart constructor ### What type of PR is it? [Bug Fix] ### What is the Jira issue? * [ZEPPELIN-533](https://issues.apache.org/jira/browse/ZEPPELIN-2253) ### How should this be tested? * Create a new pie chart using built in visualization * Remove column selected as 'key' * Add a new column as 'key' * Chart is rendered perfectly ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: ess_ess <[email protected]> Closes #2132 from sravan-s/ZEPPELIN-2253 and squashes the following commits: 310aecf [ess_ess] Initialize chart to null inside 'render()' (cherry picked from commit f2c865aaacb3788286de076246695a35fff277f8) Signed-off-by: Lee moon soo <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/1ff2752e Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/1ff2752e Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/1ff2752e Branch: refs/heads/branch-0.7 Commit: 1ff2752edd9ac3472109f4c589c2abb4de6b16fa Parents: b00e27c Author: ess_ess <[email protected]> Authored: Tue Mar 14 13:27:16 2017 +0530 Committer: Lee moon soo <[email protected]> Committed: Wed Mar 15 08:37:54 2017 -0700 ---------------------------------------------------------------------- .../src/app/visualization/builtins/visualization-piechart.js | 2 ++ 1 file changed, 2 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1ff2752e/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 8c8f8f2..9cc7922 100644 --- a/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js +++ b/zeppelin-web/src/app/visualization/builtins/visualization-piechart.js @@ -33,6 +33,8 @@ export default class PiechartVisualization extends Nvd3ChartVisualization { }; render(pivot) { + // [ZEPPELIN-2253] New chart function will be created each time inside super.render() + this.chart = null; var d3Data = this.d3DataFromPivot( pivot.schema, pivot.rows,
