Added functionality to clear the chart canvas so charts can be more easily created
This commit is contained in:
		| @@ -1,4 +1,6 @@ | |||||||
| $ -> | $ -> | ||||||
|  |   chartInstance = null | ||||||
|  |  | ||||||
|   $('#reports-download').on 'click', -> |   $('#reports-download').on 'click', -> | ||||||
|     canvas = $('#benchmark-chart')[0] |     canvas = $('#benchmark-chart')[0] | ||||||
|     a = document.createElement 'a' |     a = document.createElement 'a' | ||||||
| @@ -7,6 +9,8 @@ $ -> | |||||||
|     a.click() |     a.click() | ||||||
|  |  | ||||||
|   $('#reports-button').on 'click', (e) -> |   $('#reports-button').on 'click', (e) -> | ||||||
|  |     chartInstance.destroy() if chartInstance | ||||||
|  |  | ||||||
|     benchmarkId = $('#report-benchmarks').val() |     benchmarkId = $('#report-benchmarks').val() | ||||||
|     testIds = $('#report-tests').val() |     testIds = $('#report-tests').val() | ||||||
|  |  | ||||||
| @@ -67,7 +71,7 @@ $ -> | |||||||
|         y: |         y: | ||||||
|           beginAtZero: true |           beginAtZero: true | ||||||
|  |  | ||||||
|     new Chart ctx, |     chartInstance = new Chart ctx, | ||||||
|       type: 'bar' |       type: 'bar' | ||||||
|       data: data |       data: data | ||||||
|       options: options |       options: options | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user