Skip to content

Commit

Permalink
Fixed a bug with switching viz_type in exploreV2 (#1631)
Browse files Browse the repository at this point in the history
- Issue: when switching from a viz_type outside nvd3 to a viz_type in
 nvd3, the Chart Container doesn't draw new graph
 - Fix: The reason was somehow the function inside nv.addGraph() wasn't
   called, extract the function outside and explicitly calling it solve
   the problem
  • Loading branch information
vera-liu authored Nov 18, 2016
1 parent 2c068a1 commit 0acf26b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions superset/assets/javascripts/explorev2/stores/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ export const fields = {
'28 days ago',
'90 days ago',
'1 year ago',
'100 year ago',
]),
description: 'Timestamp from filter. This supports free form typing and ' +
'natural language as in `1 day ago`, `28 days` or `3 years`',
Expand Down
7 changes: 5 additions & 2 deletions superset/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function nvd3Vis(slice) {
const reduceXTicks = fd.reduce_x_ticks || false;
let stacked = false;
let row;
nv.addGraph(function () {

const drawGraph = function () {
switch (vizType) {
case 'line':
if (fd.show_brush) {
Expand Down Expand Up @@ -352,8 +353,10 @@ function nvd3Vis(slice) {
}

return chart;
});
};

const graph = drawGraph();
nv.addGraph(graph);
slice.done(payload);
});
};
Expand Down

0 comments on commit 0acf26b

Please sign in to comment.