Merge "Clear barchart before rendering it"

This commit is contained in:
Jenkins 2014-04-22 10:40:35 +00:00 committed by Gerrit Code Review
commit 9ab450c93d
2 changed files with 7 additions and 5 deletions

View File

@ -240,6 +240,8 @@ horizon.d3_bar_chart = {
*/ */
self.refresh = function(){ self.refresh = function(){
var self = this; var self = this;
// Clear the chart before rendering it
self.jquery_element.empty();
self.render(); self.render();
}; };

View File

@ -374,8 +374,8 @@ horizon.d3_line_chart = {
url: self.final_url, url: self.final_url,
success: function (data, textStatus, jqXHR) { success: function (data, textStatus, jqXHR) {
// Clearing the old chart data. // Clearing the old chart data.
$(self.html_element).html(''); self.jquery_element.empty();
$(self.legend_element).html(''); $(self.legend_element).empty();
self.series = data.series; self.series = data.series;
self.stats = data.stats; self.stats = data.stats;
@ -384,7 +384,7 @@ horizon.d3_line_chart = {
if (self.series.length <= 0) { if (self.series.length <= 0) {
$(self.html_element).html(gettext('No data available.')); $(self.html_element).html(gettext('No data available.'));
$(self.legend_element).html(''); $(self.legend_element).empty();
// Setting a fix height breaks things when legend is getting // Setting a fix height breaks things when legend is getting
// bigger. // bigger.
$(self.legend_element).css('height', ''); $(self.legend_element).css('height', '');
@ -394,7 +394,7 @@ horizon.d3_line_chart = {
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
$(self.html_element).html(gettext('No data available.')); $(self.html_element).html(gettext('No data available.'));
$(self.legend_element).html(''); $(self.legend_element).empty();
// Setting a fix height breaks things when legend is getting // Setting a fix height breaks things when legend is getting
// bigger. // bigger.
$(self.legend_element).css('height', ''); $(self.legend_element).css('height', '');
@ -548,7 +548,7 @@ horizon.d3_line_chart = {
$(self.html_element).append(self.backdrop); $(self.html_element).append(self.backdrop);
// Hide the legend. // Hide the legend.
$(self.legend_element).html('').addClass('disabled'); $(self.legend_element).empty().addClass('disabled');
// Show the spinner. // Show the spinner.
self.spinner = $('<div class="spinner_wrapper"></div>'); self.spinner = $('<div class="spinner_wrapper"></div>');