diff --git a/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj b/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj index 24c1e706..89b95862 100644 --- a/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj +++ b/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj @@ -1,7 +1,7 @@ - 9.0.0 + 9.0.1 diff --git a/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js b/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js index 6f6f6c58..5426896f 100644 --- a/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js +++ b/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js @@ -1,16 +1,11 @@ import '../../js/chart.umd.js' import '../../js/chartjs-plugin-datalabels.js' +import { deepMerge } from '../../../BootstrapBlazor/modules/utility.js' import Data from '../../../BootstrapBlazor/modules/data.js' import EventHandler from "../../../BootstrapBlazor/modules/event-handler.js" Chart.register(ChartDataLabels); -// WIP: wait net9 release -// later will move into bootstrapblazor for global init make sure window.BootstrapBlazor is defined -if (window.BootstrapBlazor === void 0) { - window.BootstrapBlazor = {}; -} - if (window.BootstrapBlazor.Chart === void 0) { const elementMap = new Map(); window.BootstrapBlazor.Chart = new class { @@ -99,20 +94,6 @@ const genericOptions = { radius: 0 } -const deepMerge = (obj1, obj2) => { - for (let key in obj2) { - if (obj2.hasOwnProperty(key)) { - if (obj2[key] instanceof Object && obj1[key] instanceof Object) { - obj1[key] = deepMerge(obj1[key], obj2[key]); - } - else { - obj1[key] = obj2[key]; - } - } - } - return obj1; -} - const getChartOption = function (option) { const appendData = option.appendData; delete option.appendData; @@ -388,7 +369,7 @@ const getChartOption = function (option) { datalabels: { anchor: option.options.anchor, align: option.options.align, - formatter: Math.round, + formatter: option.options.formatter, display: option.options.showDataLabel, color: option.options.chartDataLabelColor, font: {