Private GIT

Skip to content
Snippets Groups Projects
Commit 4b75c817 authored by Jean-Baptiste's avatar Jean-Baptiste Committed by Matthieu Kermagoret
Browse files

fix(chart): fix extra legend on period change

parent a0c6ffef
No related branches found
No related tags found
No related merge requests found
......@@ -30,10 +30,6 @@
});
}
/* Prepare extra legends */
this.legendDiv = jQuery('<div>').addClass('chart-legends');
this.$elem.after(this.legendDiv);
this.timeFormat = this.getTimeFormat();
/* Color for status graph */
......@@ -51,6 +47,10 @@
this.loadGraphId();
/* Prepare extra legends */
this.legendDiv = jQuery('<div>').addClass('chart-legends').attr('id', 'chart-legends-' + this.id);
this.$elem.after(this.legendDiv);
/* Get start time and end time */
times = this.getTimes();
......@@ -275,7 +275,7 @@
} else {
self.chart.load(self.buildMetricData(data[0]).data);
self.chart.regions(self.buildRegions(data[0]));
self.buildExtraLegend(data[0].legends);
self.buildExtraLegend(data[0].legends, data[0].service_id);
}
}
});
......@@ -808,12 +808,13 @@
* Build for display the extra legends
*
* @param {String[]} legends - The list of legends to display
* @param {String} service_id - The host id and service id
*/
buildExtraLegend: function (legends) {
buildExtraLegend: function (legends, service_id) {
var self = this;
var i;
jQuery('.chart-legend').each(function (idx, el) {
jQuery('#chart-legends-' + service_id + ' .chart-legend').each(function (idx, el) {
var legendName = jQuery(el).data('legend');
if (!self.ids.hasOwnProperty(legendName)) {
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment