diff --git a/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj b/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj index 2938cdfd..5bce8c32 100644 --- a/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj +++ b/src/components/BootstrapBlazor.Chart/BootstrapBlazor.Chart.csproj @@ -1,7 +1,7 @@ - 10.0.3 + 10.0.4 diff --git a/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js b/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js index 609a021f..c3143355 100644 --- a/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js +++ b/src/components/BootstrapBlazor.Chart/Components/Chart/Chart.razor.js @@ -380,6 +380,11 @@ const getChartOption = function (option) { } } + let showDataLabel = option.options.showDataLabel; + if (showDataLabel === true && option.options.x.stacked) { + showDataLabel = context => Number(context.dataset?.data[context.dataIndex]) !== 0; + } + return { ...config, ...{ @@ -404,7 +409,7 @@ const getChartOption = function (option) { anchor: option.options.anchor, align: option.options.align, formatter: option.options.formatter, - display: option.options.showDataLabel, + display: showDataLabel, color: option.options.chartDataLabelColor, font: { weight: 'bold'