File tree Expand file tree Collapse file tree 2 files changed +25
-11
lines changed
docs/BlazorApexCharts.Docs/Components/Events/DataPointSelection Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change 7
7
OnDataPointSelection =DataPointsSelected
8
8
@ref =chart >
9
9
10
- <ApexPointSeries TItem =" Order"
10
+ <ApexPointSeries TItem =" Order"
11
11
Items =" Orders"
12
- Name =" Gross Value"
12
+ Name =" Net Value"
13
13
SeriesType =" SeriesType.Line"
14
14
XValue =" @(e => e.Country)"
15
- YAggregate =" @(e => e.Sum(e => e.GrossValue ))"
15
+ YAggregate =" @(e => e.Sum(e => e.NetValue ))"
16
16
OrderByDescending =" e=>e.X" />
17
17
18
18
<ApexPointSeries TItem =" Order"
19
19
Items =" Orders"
20
- Name =" Net Value"
21
- SeriesType =" SeriesType.Line "
20
+ Name =" Gross Value"
21
+ SeriesType =" SeriesType.Bar "
22
22
XValue =" @(e => e.Country)"
23
- YAggregate =" @(e => e.Sum(e => e.NetValue ))"
23
+ YAggregate =" @(e => e.Sum(e => e.GrossValue ))"
24
24
OrderByDescending =" e=>e.X" />
25
+
26
+
25
27
</ApexChart >
26
28
</DemoContainer >
27
29
Original file line number Diff line number Diff line change @@ -39,9 +39,6 @@ public partial class ApexChart<TItem> : IDisposable where TItem : class
39
39
private string chartId ;
40
40
public string ChartId => ChartId ;
41
41
42
-
43
-
44
-
45
42
protected override async Task OnAfterRenderAsync ( bool firstRender )
46
43
{
47
44
if ( firstRender && isReady == false )
@@ -223,13 +220,28 @@ private void UpdateDataForNoAxisCharts()
223
220
{
224
221
Options . Colors = colors ;
225
222
}
226
-
223
+ }
224
+
225
+
226
+ private bool ShouldFixDataSelection ( )
227
+ {
228
+ if ( ! OnDataPointSelection . HasDelegate || ! Options . Series . Any ( ) ) { return false ; }
229
+
230
+ if ( Options . Chart ? . Type != null && Options . Chart . Type == ChartType . Line || Options . Chart . Type == ChartType . Area || Options . Chart . Type == ChartType . Radar )
231
+ {
232
+ return true ;
233
+ }
234
+
235
+ if ( Options . Series . Any ( e=> e . Type == MixedType . Line || e . Type == MixedType . Area ) ) {
236
+ return true ;
237
+ }
227
238
239
+ return false ;
228
240
}
229
241
230
242
private void FixLineDataSelection ( )
231
243
{
232
- if ( ( Options . Chart . Type == ChartType . Line || Options . Chart . Type == ChartType . Area || Options . Chart . Type == ChartType . Radar ) && OnDataPointSelection . HasDelegate )
244
+ if ( ShouldFixDataSelection ( ) )
233
245
{
234
246
if ( Options . Tooltip == null ) { Options . Tooltip = new Tooltip ( ) ; }
235
247
if ( Options . Markers == null ) { Options . Markers = new Markers ( ) ; }
You can’t perform that action at this time.
0 commit comments