Since Chart is updated to 26.*, ChartSeries XName does not dynamically refreshed. It is not reproduced in 25.*. Below screenshot shows that "GroupBy" button changes data label in DataGrid but XName in ChartSeries. RefreshAsync resolves the issue but it flicker the chart area.
<div class="row">
<div class="col">
<SfToolbar OverflowMode="OverflowMode.Extended">
<ToolbarItems>
<ToolbarItem CssClass="e-flat" Text="Prev" Type="ItemType.Button" PrefixIcon="e-icons e-chevron-left-small" TooltipText="Prev Month" OnClick="PrevMonthClicked"></ToolbarItem>
<ToolbarItem CssClass="e-flat" Text="Next" Type="ItemType.Button" PrefixIcon="e-icons e-chevron-right-small" TooltipText="Next Month" OnClick="NextMonthClicked"></ToolbarItem>
<ToolbarItem CssClass="e-flat" Text="Current" Type="ItemType.Button" PrefixIcon="e-icons e-week" TooltipText="This Month" OnClick="ThisMonthClicked"></ToolbarItem>
<ToolbarItem Type="ItemType.Separator" />
<ToolbarItem CssClass="e-flat" Text="Custom" Align="ItemAlign.Left">
<Template>
<SfDateRangePicker @bind-StartDate="StartDate" @bind-EndDate="EndDate" AllowEdit="true" />
</Template>
</ToolbarItem>
<ToolbarItem Type="ItemType.Separator" />
<ToolbarItem Type="ItemType.Input">
<Template>
<SfButtonGroup Mode="Syncfusion.Blazor.SplitButtons.SelectionMode.Single" CssClass="e-flat">
<ButtonGroupButton IsPrimary="true" @onclick="@(() => { GroupBy = "EquipmentType"; })" Selected="true">Equipment Type</ButtonGroupButton>
<ButtonGroupButton @onclick="@(() => { GroupBy = "AssetId"; })">Asset Id</ButtonGroupButton>
@* <ButtonGroupButton @onclick="@(() => { GroupBy = "Manufacturer"; })">Manufacturer</ButtonGroupButton> *@
<ButtonGroupButton @onclick="@(() => { GroupBy = "ModelNumber"; })">Model Number</ButtonGroupButton>
</SfButtonGroup>
</Template>
</ToolbarItem>
<ToolbarItem Type="ItemType.Spacer" />
<ToolbarItem Type="ItemType.Input">
<Template>
<SfCheckBox Label="Include All" @bind-Checked="IncludeAll"></SfCheckBox>
</Template>
</ToolbarItem>
<ToolbarItem CssClass="e-flat" Text="Export" Type="ItemType.Button" PrefixIcon="e-icons e-export-excel" TooltipText="Export Excel" OnClick="ExportExcel"></ToolbarItem>
</ToolbarItems>
</SfToolbar>
</div>
</div>
<div class="row py-2">
<div class="col-md-4 py-2 px-4">
<SfGrid DataSource="_groupCounts" TValue="GroupCount" AllowPaging="true">
<GridTemplates>
<ToolbarTemplate>
<SfToolbar CssClass="px-2">
<ToolbarItems>
<ToolbarItem Type="@ItemType.Input" Text="PageSize">
<SfComboBox @bind-Value="@_groupCountsPageSize" DataSource="@_pageSizeDisplayOptions" Width="60px" ShowClearButton="false" CssClass="e-small">
<ComboBoxFieldSettings Value="Name"></ComboBoxFieldSettings>
</SfComboBox>
</ToolbarItem>
</ToolbarItems>
</SfToolbar>
</ToolbarTemplate>
</GridTemplates>
<GridPageSettings PageSize="@_groupCountsPageSize"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(GroupCount.Key) HeaderText="Key" Width="130px" HeaderTextAlign="TextAlign.Center" TextAlign="TextAlign.Center"/>
<GridColumn Field=@nameof(GroupCount.ReviewedCount) HeaderText="Reviewed" Width="85px" HeaderTextAlign="TextAlign.Center" TextAlign="TextAlign.Center">
<Template>
@{
var groupCount = context as GroupCount;
<span class="reviewed_count">@groupCount?.ReviewedCount</span>
}
</Template>
</GridColumn>
<GridColumn Field=@nameof(GroupCount.TotalCount) HeaderText="Total" Width="75px" HeaderTextAlign="TextAlign.Center" TextAlign="TextAlign.Center">
<Template>
@{
var groupCount = context as GroupCount;
<span class="total_count">@groupCount?.TotalCount</span>
}
</Template>
</GridColumn>
</GridColumns>
</SfGrid>
</div>
<div class="col-md-8">
<SfChart @ref="_groupCountChart" Palettes="@_palettes" Height="320px">
<ChartPrimaryXAxis Title="@_groupBy" ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartPrimaryYAxis Title="Count" />
<ChartSeriesCollection>
<ChartSeries DataSource="@_groupCounts" XName="Key" YName="ReviewedCount" Width="1" Opacity="0.8" Type="ChartSeriesType.Column" />
<ChartSeries DataSource="@_groupCounts" XName="Key" YName="TotalCount" Width="1" Opacity="0.8" Type="ChartSeriesType.Column" />
</ChartSeriesCollection>
<ChartLegendSettings ToggleVisibility="true" Position="LegendPosition.Auto" />
</SfChart>
</div>
</div>
Hi Yongkee,
We have prepared the sample based on your requirement in latest version. The Month field is assigned for chart series XName. The chart is displayed properly with specified field value in grid.
Sample : https://blazorplayground.syncfusion.com/VjBpXmNuzyJWiTJc
To better analyze the reported issue and provide a timely solution, we need additional information. Please assist us by providing the following details.
This information will greatly aid us in understanding the scenario and resolving the problem efficiently. Kindly revert us if you have any other concerns.
Regards,
Durga Gopalakrishnan.
Hi Durga. Sorry about the confusion.
Yes, it shows data correctly for the first time. However, in my example, the group buttons switch between different counts with different labels. The buttons make changes immediately in DataGrid but late in Chart. Another click of the same button make Chart data changed.
This doesn't occur in 25.*.*.
This forum doesn't allow me to insert an animated GIF so I cannot show what exactly it is.
Yongkee,
We have ensured your reported scenario by changing the grid column field, the chart XName and YName names dynamically on button click; unfortunately, we are unable to replicate the reported problem. Please check with the below snippet and screenshot.
|
public void ChangeData() { xName = headerText1 = "X"; yName1 = headerText2 = "Y1"; yName2 = headerText3 = "Y2"; grid.Refresh(); chart.RefreshAsync(); } |
Before Update
After Update
Sample : https://blazorplayground.syncfusion.com/BZBJjmsZzyjNXQqg
If you are still facing problem, please try to replicate an issue in above sample or share us issue reproduced sample which will be helpful for us to analyze further and assist you better.
As mentioned on the original post, the Chart had been updated without calling RefreshAsync in <25.*. And I am asking if there is other way but RefreshAsync in 26.*. RefreshAsync flickers the chart area and hard to call an async method in a property.
Currently your 26.* DataGrid updates current data without Refresh call; your 26.* Chart shows previous data without RefreshAsync
Yongkee,
We have considered your reported scenario as bug and logged a defect report for this issue. This fix will be available in our weekly patch release which is scheduled to be rolled out on 30th July 2024. We appreciate your patience until then. You can keep track of the bug from the below feedback link.
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
Yongkee,
We are glad to announce that our v26.2.7 patch release is rolled out; we have added the fix for reported issue. You can use the latest Syncfusion.Blazor.Charts NuGet package.
Root Cause:
The chart axes are not refreshed when dynamically updating the chart series XName values.
Fix:
Refreshed the chart axis values when the XName values are changed.
NuGet Package : https://www.nuget.org/packages/Syncfusion.Blazor.Charts/
Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/XNameUpd-548571885.zip
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
The problem still remains. I
Yongkee,
We have ensured the reported scenario in both server and wasm application; unfortunately, we are unable to replicate the reported problem from our end. We have attached the tested sample for your reference.
Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp21815157195.zip
We request you to clear both the NuGet cache and the browser cache before running the application. Additionally, please replicate the issue in the attached sample. This will help us to validate the case further on our end. Please let us know if you have any concerns.