Fixed a bug with switching viz_type in exploreV2 (#1631)

- 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
This commit is contained in:
vera-liu 2016-11-18 10:23:00 -08:00 committed by GitHub
parent 2c068a1a15
commit 0acf26b37c
2 changed files with 6 additions and 2 deletions

View File

@ -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`',

View File

@ -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) {
@ -352,8 +353,10 @@ function nvd3Vis(slice) {
}
return chart;
});
};
const graph = drawGraph();
nv.addGraph(graph);
slice.done(payload);
});
};