Hi there,
Here is the context :
Radzen Bar Chart
Radzen Value Axis with Min="0"
Empty dataset or not empty with values equals 0
I can reproduce on the demo (using the following code)
@using System.Globalization
<RadzenStack class="rz-p-0 rz-p-md-6 rz-p-lg-12">
<RadzenCard Variant="Variant.Outlined">
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem" Wrap="FlexWrap.Wrap">
<RadzenCheckBox @bind-Value="@showDataLabels" Name="dataLabels"></RadzenCheckBox>
<RadzenLabel Text="Show Data Labels" Component="dataLabels" />
</RadzenStack>
</RadzenCard>
<RadzenRow>
<RadzenColumn Size="12" SizeLG="6">
<h4>Auto-size bar series</h4>
<RadzenChart SeriesClick=@OnSeriesClick style="height: 400px">
<RadzenBarSeries Data="@revenue2023" CategoryProperty="Quarter" Title="2023" ValueProperty="Revenue">
<RadzenSeriesDataLabels Visible="@showDataLabels" />
</RadzenBarSeries>
<RadzenValueAxis Min="0" Formatter="@FormatAsUSD">
<RadzenGridLines Visible="true" />
<RadzenAxisTitle Text="Revenue in USD" />
</RadzenValueAxis>
<RadzenBarOptions Radius="5" />
</RadzenChart>
</RadzenColumn>
</RadzenRow>
</RadzenStack>
<EventConsole @ref=@console />
@code {
EventConsole console;
bool showDataLabels = false;
void OnSeriesClick(SeriesClickEventArgs args)
{
console.Log(args);
}
class DataItem
{
public string Quarter { get; set; }
public double Revenue { get; set; }
}
string FormatAsUSD(object value)
{
return ((double)value).ToString("C0", CultureInfo.CreateSpecificCulture("en-US"));
}
DataItem[] revenue2023 = new DataItem[]{};
}
Have a nice day !