From c93c8ac6de82d0ae942875d06dc3652d89839f34 Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Tue, 6 Jun 2017 16:40:18 -0500 Subject: [PATCH] Add comments to workaround for legend disappear on redraw --- ui/src/shared/components/Dygraph.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/shared/components/Dygraph.js b/ui/src/shared/components/Dygraph.js index d9cbe17c08..e587fd8e10 100644 --- a/ui/src/shared/components/Dygraph.js +++ b/ui/src/shared/components/Dygraph.js @@ -30,7 +30,7 @@ export default class Dygraph extends Component { isSynced: false, } - // workaround for dygraph.updateOptions breaking legends + // optional workaround for dygraph.updateOptions breaking legends // a la http://stackoverflow.com/questions/38371876/dygraph-dynamic-update-legend-values-disappear // this.lastMouseMoveEvent = null // this.isMouseOverGraph = false @@ -106,6 +106,7 @@ export default class Dygraph extends Component { unhighlightCallback: () => { legendContainerNode.className = 'container--dygraph-legend hidden' // hide + // part of optional workaround for preventing updateOptions from breaking legend // this.isMouseOverGraph = false }, highlightCallback: e => { @@ -143,6 +144,7 @@ export default class Dygraph extends Component { legendContainerNode.style.left = `${legendLeft}px` legendContainerNode.style.top = `${legendTop}px` + // part of optional workaround for preventing updateOptions from breaking legend // this.isMouseOverGraph = true // this.lastMouseMoveEvent = e }, @@ -214,6 +216,7 @@ export default class Dygraph extends Component { underlayCallback: options.underlayCallback, series: dygraphSeries, }) + // part of optional workaround for preventing updateOptions from breaking legend // if (this.lastMouseMoveEvent) { // dygraph.mouseMove_(this.lastMouseMoveEvent) // }