« ApexCharts » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 4 : | Ligne 4 : | ||
* [https://apexcharts.com ApexCharts] | * [https://apexcharts.com ApexCharts] | ||
* [https://apexcharts.com/docs/datalabels DataLabels] | * [https://apexcharts.com/docs/datalabels DataLabels] | ||
= [https://github.com/apexcharts/Blazor-ApexCharts Blazor-ApexCharts] = | |||
<filebox fn='Page.razor'> | |||
<ApexChart | |||
@ref=chart | |||
Options=chartOptions | |||
TItem="Item" | |||
Title="Items"> | |||
<ApexPointSeries | |||
TItem="Item" | |||
Items="items" | |||
SeriesType="SeriesType.Scatter" | |||
XValue="@(x => x.Datetime.ToString("d MMM yy"))" | |||
YValue="@(x => x.Price)" | |||
OrderByDescending="@(x => x.X)" | |||
Color="White" | |||
PointColor="@(x => x.Valid ? "Green" : "Red")" | |||
ShowDataLabels /> | |||
</ApexChart> | |||
</filebox> | |||
<filebox fn='Page.razor.cs'> | |||
private ApexChart<TransactionDataResponse> chart = default!; | |||
private readonly ApexChartOptions<TransactionDataResponse> chartOptions = new() | |||
{ | |||
Theme = new Theme { Mode = Mode.Dark }, | |||
NoData = new NoData { Text = "Loading ..." }, | |||
DataLabels = new DataLabels | |||
{ | |||
OffsetY = -10, | |||
Background = new DataLabelsBackground { Enabled = false } | |||
} | |||
}; | |||
</filebox> |
Version du 15 août 2023 à 19:19
Links
Blazor-ApexCharts
Page.razor |
<ApexChart @ref=chart Options=chartOptions TItem="Item" Title="Items"> <ApexPointSeries TItem="Item" Items="items" SeriesType="SeriesType.Scatter" XValue="@(x => x.Datetime.ToString("d MMM yy"))" YValue="@(x => x.Price)" OrderByDescending="@(x => x.X)" Color="White" PointColor="@(x => x.Valid ? "Green" : "Red")" ShowDataLabels /> </ApexChart> |
Page.razor.cs |
private ApexChart<TransactionDataResponse> chart = default!; private readonly ApexChartOptions<TransactionDataResponse> chartOptions = new() { Theme = new Theme { Mode = Mode.Dark }, NoData = new NoData { Text = "Loading ..." }, DataLabels = new DataLabels { OffsetY = -10, Background = new DataLabelsBackground { Enabled = false } } }; |