8
8
using System . Text . Json . Serialization ;
9
9
using System . Threading . Tasks ;
10
10
11
-
12
11
namespace ApexCharts
13
12
{
14
13
public partial class ApexChart < TItem > : IDisposable where TItem : class
@@ -47,10 +46,10 @@ protected override void OnParametersSet()
47
46
if ( Options . Chart == null ) { Options . Chart = new Chart ( ) ; }
48
47
49
48
if ( Options . Chart . Type != ChartType ||
50
- Options . Chart . Width ? . ToString ( ) != Width ? . ToString ( ) ||
51
- Options . Chart . Height ? . ToString ( ) != Height ? . ToString ( ) ||
52
- Options . Xaxis ? . Type != XAxisType ||
53
- Options . Title ? . Text != Title )
49
+ Options . Chart . Width ? . ToString ( ) != Width ? . ToString ( ) ||
50
+ Options . Chart . Height ? . ToString ( ) != Height ? . ToString ( ) ||
51
+ Options . Xaxis ? . Type != XAxisType ||
52
+ Options . Title ? . Text != Title )
54
53
{
55
54
Options . ForceRender = true ;
56
55
}
@@ -74,13 +73,12 @@ protected override void OnParametersSet()
74
73
if ( Options . Title == null ) { Options . Title = new Title ( ) ; }
75
74
Options . Title . Text = Title ;
76
75
}
77
-
78
-
79
-
80
76
}
81
77
82
78
private void SetDatalabels ( )
83
79
{
80
+ if ( Options ? . Series == null ) { return ; }
81
+
84
82
if ( Options . DataLabels == null ) { Options . DataLabels = new DataLabels ( ) ; }
85
83
if ( Options . DataLabels . EnabledOnSeries == null ) { Options . DataLabels . EnabledOnSeries = new List < double > ( ) ; }
86
84
@@ -137,7 +135,6 @@ public void FixLineDataSelection()
137
135
{
138
136
if ( ( Options . Chart . Type == ChartType . Line || Options . Chart . Type == ChartType . Area ) && OnDataPointSelection . HasDelegate )
139
137
{
140
-
141
138
if ( Options . Tooltip == null ) { Options . Tooltip = new Tooltip ( ) ; }
142
139
if ( Options . Markers == null ) { Options . Markers = new Markers ( ) ; }
143
140
@@ -148,7 +145,6 @@ public void FixLineDataSelection()
148
145
149
146
Options . Tooltip . Intersect = true ;
150
147
Options . Tooltip . Shared = false ;
151
-
152
148
}
153
149
}
154
150
@@ -170,17 +166,14 @@ private async Task UpdateChart()
170
166
var jsonOptions = JsonSerializer . Serialize ( Options , serializerOptions ) ;
171
167
await JSRuntime . InvokeVoidAsync ( "blazor_apexchart.renderChart" , ObjectReference , ChartContainer , jsonOptions ) ;
172
168
await OnDataPointSelection . InvokeAsync ( null ) ;
173
-
174
169
}
175
170
176
-
177
171
public void Dispose ( )
178
172
{
179
173
GC . SuppressFinalize ( this ) ;
180
174
if ( Options . Chart ? . ChartId != null && isReady )
181
175
{
182
176
InvokeAsync ( async ( ) => { await JSRuntime . InvokeVoidAsync ( "blazor_apexchart.destroyChart" , Options . Chart . ChartId ) ; } ) ;
183
-
184
177
}
185
178
186
179
if ( ObjectReference != null )
0 commit comments