Skip to content

Commit

Permalink
Fixed chart race condition which caused some chart settings to not be…
Browse files Browse the repository at this point in the history
… applied on heavy charts.
  • Loading branch information
texodus committed Mar 12, 2018
1 parent ee69176 commit 26c4964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions packages/perspective-viewer-highcharts/src/js/highcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ function* visible_rows(json, hidden) {
}
}



export function draw(mode) {
return async function(el, view, hidden, task) {
var row_pivots = this._view_columns('#row_pivots perspective-row:not(.off)');
Expand All @@ -233,6 +231,16 @@ export function draw(mode) {

let [js, schema] = await Promise.all([view.to_json(), view.schema()]);

if (this.hasAttribute('updating') && this._chart) {
chart = this._chart
this._chart = undefined;
try {
chart.destroy();
} catch (e) {
console.warn("Scatter plot destroy() call failed - this is probably leaking memory");
}
}

if (task.cancelled) {
return;
}
Expand Down Expand Up @@ -543,16 +551,6 @@ export function draw(mode) {
});
}

if (this.hasAttribute('updating') && this._chart) {
chart = this._chart
this._chart = undefined;
try {
chart.destroy();
} catch (e) {
console.warn("Scatter plot destroy() call failed - this is probably leaking memory");
}
}

if (this._chart) {
if (mode === 'scatter') {
let new_radius = Math.min(8, Math.max(4, Math.floor((this._chart.chartWidth + this._chart.chartHeight) / 240)));
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-viewer/src/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function update() {
}).catch(err => {
console.error("Error rendering plugin.", err);
});
})(task);
})(this._task);
}, timeout || 0);
}
});
Expand Down

0 comments on commit 26c4964

Please sign in to comment.