diff --git a/docs/BlazorApexCharts.Docs/Components/Features/ChartSize/Basic.razor b/docs/BlazorApexCharts.Docs/Components/Features/ChartSize/Basic.razor
index 8ce718bb..e6dfdd49 100644
--- a/docs/BlazorApexCharts.Docs/Components/Features/ChartSize/Basic.razor
+++ b/docs/BlazorApexCharts.Docs/Components/Features/ChartSize/Basic.razor
@@ -1,22 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@code {
@@ -50,7 +50,6 @@
private async Task UpdateSize()
{
- await Task.Yield();
await chart.UpdateOptionsAsync(false, false, false);
}
diff --git a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/Basic.razor b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/Basic.razor
index c40192df..b8a1716c 100644
--- a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/Basic.razor
+++ b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/Basic.razor
@@ -58,14 +58,12 @@
private async Task RenderChart()
{
ToogleColor();
- await Task.Delay(10);
await chart.RenderAsync();
}
private async Task UpdateOptions()
{
ToogleColor();
- await Task.Delay(10);
await chart.UpdateOptionsAsync(redrawPaths, animate, false);
}
}
\ No newline at end of file
diff --git a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/MaintainZoom.razor b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/MaintainZoom.razor
index 692b96f8..0d064d5c 100644
--- a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/MaintainZoom.razor
+++ b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateOptions/MaintainZoom.razor
@@ -63,9 +63,7 @@
title = "Order Net Value " + dateString;
seriesName = "Gross Value " + dateString;
-
- await Task.Yield(); // We need this in order to update the title and series name
-
+
await chart.UpdateOptionsAsync(false, false, false, zoomOptions);
}
}
\ No newline at end of file
diff --git a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/Basic.razor b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/Basic.razor
index af6518a3..c05457e4 100644
--- a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/Basic.razor
+++ b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/Basic.razor
@@ -1,34 +1,59 @@
-
+
+
-
+
+ @if (forecasts != null)
+ {
+
+
+
+
+ }
-
-
-
-@message
+
+
+
+ @context.Date.ToString("D")
+
+
+
+
+
@code {
- private List orders { get; set; } = SampleData.GetOrders();
- private ApexChart chart;
+ private List forecasts { get; set; }
+ private ApexChart chart;
private string message;
+
+ protected override async Task OnInitializedAsync()
+ {
+ await LoadDataAsync();
+
+ await base.OnInitializedAsync();
+ }
+
+ private async Task LoadDataAsync()
+ {
+ forecasts = (await SampleData.GetForecastAsync(DateTime.Today)).ToList();
+ }
+
private async Task UpdateChartSeries()
{
- var order = orders.First();
- message = order.Country;
- order.GrossValue = order.GrossValue * (decimal)1.6;
+ await LoadDataAsync();
await chart.UpdateSeriesAsync(true);
}
- }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/FillColor.razor b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/FillColor.razor
index ee86e117..db820055 100644
--- a/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/FillColor.razor
+++ b/docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/FillColor.razor
@@ -32,7 +32,6 @@
var order = orders.First();
message = order.Country;
order.GrossValue = order.GrossValue * (decimal)1.6;
- // await chart.UpdateSeriesAsync(true);
await chart.UpdateOptionsAsync(false, false, false);
}
diff --git a/docs/BlazorApexCharts.Docs/Data/SampleData.cs b/docs/BlazorApexCharts.Docs/Data/SampleData.cs
index 862a3bad..28a6f139 100644
--- a/docs/BlazorApexCharts.Docs/Data/SampleData.cs
+++ b/docs/BlazorApexCharts.Docs/Data/SampleData.cs
@@ -2,21 +2,38 @@
using Bogus;
using System;
using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
namespace BlazorApexCharts.Docs
{
public static class SampleData
{
+ private static readonly string[] Summaries = new[]
+{
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
+
+ public static Task GetForecastAsync(DateTime startDate)
+ {
+ return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = startDate.AddDays(index),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ }).ToArray());
+ }
+
public static List GetBoxPlotData()
{
var now = DateTimeOffset.Now;
var result = new List();
- result.Add(new BoxPlotSample { Name = "Eva", EventDate=now.AddDays(-10), Min = 40, Q1 = 52, Median = 56.59m, Q3 = 60, Max = 63.85m } );
+ result.Add(new BoxPlotSample { Name = "Eva", EventDate = now.AddDays(-10), Min = 40, Q1 = 52, Median = 56.59m, Q3 = 60, Max = 63.85m });
result.Add(new BoxPlotSample { Name = "Jonas", EventDate = now.AddDays(-9), Min = 43.66m, Q1 = 44.99m, Median = 51.35m, Q3 = 52.95m, Max = 59.42m });
result.Add(new BoxPlotSample { Name = "Bart", EventDate = now.AddDays(-8), Min = 52.76m, Q1 = 57.35m, Median = 59.15m, Q3 = 63.03m, Max = 67.98m });
- result.Add(new BoxPlotSample { Name = "Cecilia", EventDate = now.AddDays(-7), Min = 48m, Q1 = 49m, Median = 52m, Q3 = 62m, Max =68m });
+ result.Add(new BoxPlotSample { Name = "Cecilia", EventDate = now.AddDays(-7), Min = 48m, Q1 = 49m, Median = 52m, Q3 = 62m, Max = 68m });
result.Add(new BoxPlotSample { Name = "Ann", EventDate = now.AddDays(-6), Min = 38m, Q1 = 41m, Median = 45m, Q3 = 52m, Max = 55m });
return result;
}
@@ -65,7 +82,7 @@ public static List GetOrdersForGroup()
}
- public static List GetOrders()
+ public static List GetOrders()
{
var orders = new List();
orders.Add(new Order { CustomerName = "Odio Corporation", Country = "Sweden", OrderDate = DateTimeOffset.Now.AddDays(-12), GrossValue = 34531, DiscountPercentage = 21, OrderType = OrderType.Contract });
@@ -115,7 +132,7 @@ public static List GetProjects()
result.Add(new Project { Name = "Design", StartDate = DateTime.Now.AddDays(-30), EndDate = DateTime.Now.AddDays(-10), Score = 20 });
result.Add(new Project { Name = "Construct", StartDate = DateTime.Now.AddDays(-20), EndDate = DateTime.Now.AddDays(-5), Score = -12 });
result.Add(new Project { Name = "Install", StartDate = DateTime.Now.AddDays(-14), EndDate = DateTime.Now.AddDays(0), Score = -4 });
- result.Add(new Project { Name = "Train", StartDate = DateTime.Now.AddDays(-18), EndDate = DateTime.Now.AddDays(5), Score = 26 });
+ result.Add(new Project { Name = "Train", StartDate = DateTime.Now.AddDays(-18), EndDate = DateTime.Now.AddDays(5), Score = 26 });
return result;
}
@@ -145,7 +162,7 @@ public static List GetSupportIncidents(int severityMin = 0, int
.RuleFor(o => o.Source, f => f.PickRandom())
.RuleFor(o => o.LeadTime, f => f.Random.Number(1, 10))
.RuleFor(o => o.WeekNumber, f => f.Random.Number(1, 20))
- .RuleFor(o => o.PointColor, f=> f.Internet.Color());
+ .RuleFor(o => o.PointColor, f => f.Internet.Color());
var test = fakeIncidents.Generate(300);
return test;
diff --git a/docs/BlazorApexCharts.Docs/Data/WeatherForecast.cs b/docs/BlazorApexCharts.Docs/Data/WeatherForecast.cs
new file mode 100644
index 00000000..26cfafb8
--- /dev/null
+++ b/docs/BlazorApexCharts.Docs/Data/WeatherForecast.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BlazorApexCharts.Docs
+{
+ public class WeatherForecast
+ {
+ public DateTime Date { get; set; }
+
+ public int TemperatureC { get; set; }
+
+ public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+
+ public string Summary { get; set; }
+ }
+}
diff --git a/src/Blazor-ApexCharts/ApexChart.razor.cs b/src/Blazor-ApexCharts/ApexChart.razor.cs
index c2f20c6c..7977cca9 100644
--- a/src/Blazor-ApexCharts/ApexChart.razor.cs
+++ b/src/Blazor-ApexCharts/ApexChart.razor.cs
@@ -663,6 +663,7 @@ public virtual async Task RemoveAnnotationAsync(string id)
///
public virtual async Task UpdateOptionsAsync(bool redrawPaths, bool animate, bool updateSyncedCharts, ZoomOptions zoom = null)
{
+ await Task.Yield();
PrepareChart();
var json = Serialize(Options);
await JSRuntime.InvokeVoidAsync("blazor_apexchart.updateOptions", Options.Chart.Id, json, redrawPaths, animate, updateSyncedCharts, zoom);
@@ -680,6 +681,7 @@ public virtual async Task UpdateOptionsAsync(bool redrawPaths, bool animate, boo
///
public virtual async Task UpdateSeriesAsync(bool animate = true)
{
+ await Task.Yield();
SetSeries();
UpdateDataForNoAxisCharts();
var jsonSeries = Serialize(Options.Series);
@@ -768,6 +770,7 @@ private void SetEvents()
private async Task RenderChartAsync()
{
+ await Task.Yield();
forceRender = false;
PrepareChart();
var jsonOptions = Serialize(Options);