diff --git a/assets/scripts/reports.coffee b/assets/scripts/reports.coffee index 77d3da0..8c7af59 100644 --- a/assets/scripts/reports.coffee +++ b/assets/scripts/reports.coffee @@ -1,4 +1,6 @@ $ -> + chartInstance = null + $('#reports-download').on 'click', -> canvas = $('#benchmark-chart')[0] a = document.createElement 'a' @@ -7,6 +9,8 @@ $ -> a.click() $('#reports-button').on 'click', (e) -> + chartInstance.destroy() if chartInstance + benchmarkId = $('#report-benchmarks').val() testIds = $('#report-tests').val() @@ -67,7 +71,7 @@ $ -> y: beginAtZero: true - new Chart ctx, + chartInstance = new Chart ctx, type: 'bar' data: data options: options