The following function is meant to clear the line chart and add a new point to the chart. However, it doesn't not work. Please can someone have a look
The following code works as expected:
<RadzenChart @ref="myChart">
<RadzenLineSeries Data="myCollection" ValueProperty="Value" CategoryProperty="Category">
<RadzenMarkers MarkerType="MarkerType.Square" />
<RadzenSeriesDataLabels Visible="true" />
</RadzenLineSeries>
<RadzenButton Click="AddItem">Add Item</RadzenButton>
</RadzenChart>
@code {
class MyItem
{
public string Category { get; set; }
public double Value { get; set; }
}
IList<MyItem> myCollection = new List<MyItem>()
{
new MyItem { Value = 50, Category = "Category" },
};
RadzenChart myChart;
void AddItem()
{
myCollection.Clear();
myCollection.Add(new MyItem { Value = 100, Category = "Category" });
myChart.Reload();
}
}