I am facing a problem where the global defaults are set properly but the bar chart is not coming up from the bottom as intended. The next thing I ran into is when the page is reloaded sometimes no chart shows up and sometimes it works as intended. The defaults are set in a extra .js file which is implemented in my _host.cshtml file.
The versions I am using:
- chartjs 3.9.1
- Blazorise.Charts NuGet Package 1.3.1
- .NET8 RC1
Here are some things I am doing:
protected override async Task OnInitializedAsync()
{
stateContainer.PropertyChanged += StateContainer_PropertyChanged;
using var dbHelper = new TelemetryDataHelper(dbContextFactory.CreateDbContext(), appCache);
eventNameCountByDateAndNameDataWithUserId = await dbHelper.GetEventNameCountByDateAndVersionAndSpecificNameAsync(EventName).ConfigureAwait(false);
UpdateAllDatasets();
await HandleRedrawCountByDateAndNameAsync().ConfigureAwait(false);
await barChartCountDate.SetOptions(chartService.GetBarChartOptionsBeginAtZero()).ConfigureAwait(false);
await barChartCountByDimensionName.SetOptions(chartService.GetBarChartOptionsBeginAtZero()).ConfigureAwait(false);
await barChartCountByMetricName.SetOptions(chartService.GetBarChartOptionsBeginAtZero()).ConfigureAwait(false);
}
public BarChartOptions GetBarChartOptionsBeginAtZero()
{
var barChartOptions = new BarChartOptions
{
Scales = new()
{
Y = new()
{
BeginAtZero = true,
},
}
};
return barChartOptions;
}
I haven't found any related article or problem on this behavior. I expect it to load correctly and when refreshing the page, it should work every time and not partial of times.