-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from apexcharts/improve-methods
Improved methods
- Loading branch information
Showing
8 changed files
with
109 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 45 additions & 20 deletions
65
docs/BlazorApexCharts.Docs/Components/Methods/UpdateSeries/Basic.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,59 @@ | ||
<DemoContainer> | ||
|
||
<DemoContainer> | ||
|
||
<Button class="mb-2" OnClick=UpdateChartSeries BackgroundColor="TablerColor.Primary">Update Series</Button> | ||
<Button class="mb-2" OnClick=UpdateChartSeries BackgroundColor="TablerColor.Primary">Update Series</Button> | ||
|
||
@if (forecasts != null) | ||
{ | ||
<ApexChart TItem="WeatherForecast" | ||
Title="Temp C" | ||
XAxisType="XAxisType.Datetime" | ||
@ref="chart"> | ||
|
||
<ApexPointSeries TItem="WeatherForecast" | ||
Items="forecasts" | ||
Name="Temp C" | ||
XValue="@(e => e.Date.ToUnixTimeMilliseconds())" | ||
YAggregate="@(e => e.Sum(f => f.TemperatureC))" | ||
SeriesType="SeriesType.Bar" | ||
Color="#005ba3" /> | ||
</ApexChart> | ||
} | ||
|
||
<ApexChart TItem="Order" | ||
Title="Order Gross Value" | ||
@ref=chart> | ||
|
||
<ApexPointSeries TItem="Order" | ||
Items="orders" | ||
Name="Gross Value" | ||
SeriesType="SeriesType.Pie" | ||
XValue="@(e => e.Country)" | ||
YAggregate="@(e => e.Sum(e => e.GrossValue))" | ||
OrderByDescending="e=>e.X" /> | ||
</ApexChart> | ||
</DemoContainer> | ||
|
||
<div> | ||
@message | ||
<Table Items="forecasts"> | ||
<Column Item="WeatherForecast" Property="e=> e.Date"> | ||
<Template> | ||
@context.Date.ToString("D") | ||
</Template> | ||
</Column> | ||
<Column Item="WeatherForecast" Property="e=> e.TemperatureC" /> | ||
<Column Item="WeatherForecast" Property="e=> e.Summary" /> | ||
</Table> | ||
</div> | ||
@code { | ||
private List<Order> orders { get; set; } = SampleData.GetOrders(); | ||
private ApexChart<Order> chart; | ||
private List<WeatherForecast> forecasts { get; set; } | ||
private ApexChart<WeatherForecast> 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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters