|
1 | | -(function () { |
| 1 | +(function () { |
2 | 2 | var CanvasJS = window.CanvasJS || CanvasJS ? window.CanvasJS : null; |
3 | 3 | if (CanvasJS) { |
4 | | - CanvasJS.Chart.prototype.exportAsCSV = function (fileName) { |
| 4 | + CanvasJS.Chart.prototype.exportAsCSV = function (fileName) { |
5 | 5 | CanvasJSDataAsCSV(this, fileName); |
6 | 6 | } |
7 | 7 | } |
|
11 | 11 | var exportCSV = document.createElement('div'); |
12 | 12 | var text = document.createTextNode("Save as CSV"); |
13 | 13 | console.log(chart) |
14 | | - exportCSV.setAttribute("style", "padding: 12px 8px; background-color: white; color: black") |
| 14 | + exportCSV.setAttribute("style", "padding: 12px 8px; background-color: " + chart.toolbar.backgroundColor + "; color: " + chart.toolbar.fontColor); |
15 | 15 | exportCSV.appendChild(text); |
16 | 16 | exportCSV.addEventListener("mouseover", function () { |
17 | | - exportCSV.setAttribute("style", "padding: 12px 8px; background-color: #2196F3; color: white") |
| 17 | + exportCSV.setAttribute("style", "padding: 12px 8px; background-color: " + chart.toolbar.backgroundColorOnHover + "; color: " + chart.toolbar.fontColorOnHover); |
18 | 18 | }); |
19 | 19 | exportCSV.addEventListener("mouseout", function () { |
20 | | - exportCSV.setAttribute("style", "padding: 12px 8px; background-color: white; color: black") |
| 20 | + exportCSV.setAttribute("style", "padding: 12px 8px; background-color: " + chart.toolbar.backgroundColor + "; color: " + chart.toolbar.fontColor); |
21 | 21 | }); |
22 | 22 | exportCSV.addEventListener("click", function () { |
23 | 23 | parseCSV({ |
|
31 | 31 | var base64Img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEgSURBVEhL3dM/SgNBFMfxBS8gWkYb0dJSyBGCwdIzRPAKgrZKINdIkVJB0qqteIdYCYoHEPX74P1gMszuzG5SiD/4wM6/99jJpvq3GeIVPwUu0ToLpIrVad1EB3Pp3KRLA1PcRAdyCYtLURNtziUsHMqmeGOUxnNtPs2cZNp+mk2S0eIteu7O5y5wgFN8Yw8vePZnnZVktLiDJzxi1+cOfe4GHxhhgjHOoLOSTLgYbjZz7OPaxzOc4Nif4/3JaNHe4MHpDc7xiW284R1b2IS9ka61MWpg925NrPi9z9mfx65pgC+fO0Lfn21/Nqt8RUo8XordZ9cmSjyuTfHGKH+nQe6qptiA5QqpPcbWkin5PXJNaot3Tdhk7cUVKxwUr6pfwprgQh4A9MYAAAAASUVORK5CYII="; |
32 | 32 | var exportButton = document.createElement('button'); |
33 | 33 |
|
34 | | - exportButton.style.cssText = "position:relative;display: inline-block;padding: 0px 4px;height: 27px;cursor: pointer;text-align: center;text-decoration: none;background-color: #fff;border: 1px solid rgb(33, 150, 243);left:" + (chart.container.clientWidth - (chart.options.zoomEnabled ? 115 : 60)) + "px; top: 1px"; |
| 34 | + exportButton.style.cssText = "position:relative;display: inline-block;padding: 0px 4px;height: 27px;cursor: pointer;text-align: center;text-decoration: none;background-color:" + chart.toolbar.backgroundColor + ";border: 1px solid " + chart.toolbar.borderColor + ";left:" + (chart.container.clientWidth - (chart.options.zoomEnabled ? 115 : 60)) + "px; top: 1px"; |
35 | 35 |
|
36 | 36 | var img = document.createElement("IMG"); |
37 | 37 | img.setAttribute("src", base64Img); |
38 | 38 | exportButton.appendChild(img); |
39 | 39 | exportButton.addEventListener("mouseover", function () { |
40 | | - this.style.cssText = this.style.cssText + "background-color: rgb(33, 150, 243)"; |
| 40 | + this.style.cssText = this.style.cssText + "background-color: " + chart.toolbar.backgroundColorOnHover; |
41 | 41 | }); |
42 | 42 | exportButton.addEventListener("mouseout", function () { |
43 | | - this.style.cssText = this.style.cssText + "background-color: #fff;"; |
| 43 | + this.style.cssText = this.style.cssText + "background-color: " + chart.toolbar.backgroundColor; |
44 | 44 | }); |
45 | 45 | exportButton.addEventListener("click", function () { |
46 | 46 | parseCSV({ |
|
0 commit comments