From 74a3b1051ab29f388c0184800fdea47d150d8215 Mon Sep 17 00:00:00 2001 From: Derek Marcotte Date: Sat, 18 Feb 2017 05:03:32 -0500 Subject: [PATCH] Add rickshawGraph proerty to the Graph object. (#2438) Add rickshawGraph property to the Graph object. This allows further changes to be made to the graph, for example, annotations. --- web/ui/static/js/prom_console.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/ui/static/js/prom_console.js b/web/ui/static/js/prom_console.js index ed2fe8682..2192c8b7e 100644 --- a/web/ui/static/js/prom_console.js +++ b/web/ui/static/js/prom_console.js @@ -332,6 +332,9 @@ PromConsole.Graph = function(params) { this.params = params; this.rendered_data = null; + // Keep a reference so that further updates (e.g. annotations) can be made + // by the user in their templates. + this.rickshawGraph = null; PromConsole._graph_registry.push(this); /* @@ -504,6 +507,8 @@ PromConsole.Graph.prototype._render = function(data) { xAxis.render(); yAxis.render(); graph.render(); + + this.rickshawGraph = graph; }; PromConsole.Graph.prototype._clearGraph = function() { @@ -513,6 +518,7 @@ PromConsole.Graph.prototype._clearGraph = function() { while (this.legendDiv.lastChild) { this.legendDiv.removeChild(this.legendDiv.lastChild); } + this.rickshawGraph = null; }; PromConsole.Graph.prototype._xhrs = [];