|
1 | 1 | import '../../js/chart.umd.js' |
2 | 2 | import '../../js/chartjs-plugin-datalabels.js' |
| 3 | +import { deepMerge } from '../../../BootstrapBlazor/modules/utility.js' |
3 | 4 | import Data from '../../../BootstrapBlazor/modules/data.js' |
4 | 5 | import EventHandler from "../../../BootstrapBlazor/modules/event-handler.js" |
5 | 6 |
|
6 | 7 | Chart.register(ChartDataLabels); |
7 | 8 |
|
8 | | -// WIP: wait net9 release |
9 | | -// later will move into bootstrapblazor for global init make sure window.BootstrapBlazor is defined |
10 | | -if (window.BootstrapBlazor === void 0) { |
11 | | - window.BootstrapBlazor = {}; |
12 | | -} |
13 | | - |
14 | 9 | if (window.BootstrapBlazor.Chart === void 0) { |
15 | 10 | const elementMap = new Map(); |
16 | 11 | window.BootstrapBlazor.Chart = new class { |
@@ -99,20 +94,6 @@ const genericOptions = { |
99 | 94 | radius: 0 |
100 | 95 | } |
101 | 96 |
|
102 | | -const deepMerge = (obj1, obj2) => { |
103 | | - for (let key in obj2) { |
104 | | - if (obj2.hasOwnProperty(key)) { |
105 | | - if (obj2[key] instanceof Object && obj1[key] instanceof Object) { |
106 | | - obj1[key] = deepMerge(obj1[key], obj2[key]); |
107 | | - } |
108 | | - else { |
109 | | - obj1[key] = obj2[key]; |
110 | | - } |
111 | | - } |
112 | | - } |
113 | | - return obj1; |
114 | | -} |
115 | | - |
116 | 97 | const getChartOption = function (option) { |
117 | 98 | const appendData = option.appendData; |
118 | 99 | delete option.appendData; |
@@ -388,7 +369,7 @@ const getChartOption = function (option) { |
388 | 369 | datalabels: { |
389 | 370 | anchor: option.options.anchor, |
390 | 371 | align: option.options.align, |
391 | | - formatter: Math.round, |
| 372 | + formatter: option.options.formatter, |
392 | 373 | display: option.options.showDataLabel, |
393 | 374 | color: option.options.chartDataLabelColor, |
394 | 375 | font: { |
|
0 commit comments