mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
parent
2eb2e17e07
commit
a586f3025f
1 changed files with 6 additions and 1 deletions
|
@ -35,6 +35,7 @@ export class ChartTarget extends React.Component {
|
|||
componentWillUnmount() {
|
||||
this.shutdownChart();
|
||||
window.removeEventListener('resize', this._handleResize);
|
||||
this.componentUnmounted = true;
|
||||
}
|
||||
|
||||
filterByShow(seriesToShow) {
|
||||
|
@ -62,7 +63,6 @@ export class ChartTarget extends React.Component {
|
|||
|
||||
componentDidMount() {
|
||||
this.renderChart();
|
||||
window.addEventListener('resize', this._handleResize, false);
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
@ -94,6 +94,9 @@ export class ChartTarget extends React.Component {
|
|||
const data = this.filterData(series, this.props.seriesToShow);
|
||||
|
||||
this.plot = $.plot(target, data, await this.getOptions());
|
||||
if (this.componentUnmounted || !this.plot) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._handleResize = () => {
|
||||
if (!this.plot) { return; }
|
||||
|
@ -110,6 +113,8 @@ export class ChartTarget extends React.Component {
|
|||
}
|
||||
};
|
||||
|
||||
window.addEventListener('resize', this._handleResize, false);
|
||||
|
||||
this.handleMouseLeave = () => {
|
||||
eventBus.trigger('thorPlotLeave', []);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue