-
Notifications
You must be signed in to change notification settings - Fork 91
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 #514 from apexcharts/annotation-point-event
Fixed Annotation events
- Loading branch information
Showing
5 changed files
with
93 additions
and
16 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
77 changes: 77 additions & 0 deletions
77
docs/BlazorApexCharts.Docs/Components/Features/Annotations/PointEvents.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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<DemoContainer> | ||
<ApexChart TItem="Order" | ||
Title="Scatter Sample" | ||
Options=options | ||
OnAnnotationPointClick="AnnotationEvent" | ||
OnAnnotationPointMouseEnter="AnnotationEvent" | ||
OnAnnotationPointMouseLeave="AnnotationEvent" | ||
|
||
Debug> | ||
|
||
<ApexPointSeries TItem="Order" | ||
Items="orders" | ||
Name="% Gross" | ||
SeriesType="SeriesType.Bar" | ||
XValue="@(e => e.DiscountPercentage)" | ||
YValue="@(e => e.GrossValue)" | ||
OrderByDescending="e=>e.X" /> | ||
|
||
<ApexPointSeries TItem="Order" | ||
Items="orders" | ||
SeriesType="SeriesType.Bar" | ||
Name="% Net" | ||
XValue="@(e => e.DiscountPercentage)" | ||
YValue="@(e => e.NetValue)" | ||
OrderByDescending="e=>e.X" /> | ||
</ApexChart> | ||
|
||
<h3 class="mt-3">@message</h3> | ||
|
||
</DemoContainer> | ||
|
||
@code { | ||
private List<Order> orders { get; set; } = SampleData.GetOrders(); | ||
private ApexChartOptions<Order> options = new ApexChartOptions<Order>(); | ||
|
||
private string message; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
|
||
options.Annotations = new Annotations | ||
{ | ||
|
||
|
||
Points = new List<AnnotationsPoint> { new AnnotationsPoint | ||
{ | ||
Label = new Label { | ||
Text = "Point 1", | ||
Style = new Style{ Background="yellow" } | ||
}, | ||
X = 20, | ||
Y = 50000 | ||
}, | ||
new AnnotationsPoint | ||
{ | ||
Label = new Label { | ||
Text = "Point 2", | ||
Style = new Style{ Background="red" } | ||
}, | ||
X = 40, | ||
Y = 60000 | ||
} | ||
} | ||
|
||
|
||
|
||
}; | ||
} | ||
|
||
|
||
private void AnnotationEvent(AnnotationEvent<Order> e) | ||
{ | ||
message = $"{e.EventType} {e.Target}: '{e.Annotation?.Label?.Text}' [{e.AnnotationId}]"; | ||
} | ||
|
||
|
||
} |
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