@@ -112,16 +112,22 @@ public partial class Chart : IDisposable
112
112
113
113
#region Public functions
114
114
115
+ /// <summary>
116
+ /// Adds the data.
117
+ /// </summary>
118
+ /// <param name="labels">The labels.</param>
119
+ /// <param name="datasetIndex">Index of the dataset.</param>
120
+ /// <param name="data">The data.</param>
115
121
public async void AddData ( List < string ? > labels , int datasetIndex , List < decimal ? > data )
116
122
{
117
123
await JSModule . AddData ( Config . CanvasId , labels , datasetIndex , data ) ;
118
124
}
119
125
120
- public async void ClearData ( )
121
- {
122
- await JSModule . ClearData ( Config . CanvasId ) ;
123
- }
124
-
126
+ /// <summary>
127
+ /// Adds the dataset.
128
+ /// </summary>
129
+ /// <typeparam name="T"></typeparam>
130
+ /// <param name="dataset">The dataset.</param>
125
131
public async void AddDataset < T > ( T dataset ) where T : class
126
132
{
127
133
await JSModule . AddNewDataset ( Config . CanvasId , dataset ) ;
@@ -131,7 +137,14 @@ public async void AddDataset<T>(T dataset) where T : class
131
137
132
138
#endregion Parameters
133
139
134
- protected override async Task OnAfterRenderAsync ( bool firstRender )
140
+ /// <summary>
141
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
142
+ /// </summary>
143
+ public void Dispose ( )
144
+ {
145
+ }
146
+
147
+ protected override async Task OnAfterRenderAsync ( bool firstRender )
135
148
{
136
149
if ( Config != null ) {
137
150
if ( OldConfig == null || Config != OldConfig ) {
@@ -145,7 +158,12 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
145
158
}
146
159
}
147
160
148
- private ValueTask OnMouseOutAsync ( MouseEventArgs mouseEventArgs )
161
+ /// <summary>
162
+ /// Handles the <see cref="E:MouseOutAsync" /> event.
163
+ /// </summary>
164
+ /// <param name="mouseEventArgs">The <see cref="Microsoft.AspNetCore.Components.Web.MouseEventArgs" /> instance containing the event data.</param>
165
+ /// <returns>System.Threading.Tasks.ValueTask.</returns>
166
+ private ValueTask OnMouseOutAsync ( MouseEventArgs mouseEventArgs )
149
167
{
150
168
if ( Config . Options is Options { OnMouseOutAsync : { } } options )
151
169
return options . OnMouseOutAsync ( mouseEventArgs ) ;
@@ -155,38 +173,23 @@ private ValueTask OnMouseOutAsync(MouseEventArgs mouseEventArgs)
155
173
156
174
#region JavaScript invokable functions
157
175
158
- [ JSInvokable ]
159
- public static string [ ] TitleCallbacks ( DotNetObjectReference < IChartConfig > config , decimal [ ] parameters )
160
- {
161
- var ctx = new CallbackGenericContext ( ( int ) parameters [ 0 ] , ( int ) parameters [ 1 ] , parameters [ 2 ] ) ;
162
- if ( config . Value . Options is Options options )
163
- return options . Plugins . Tooltip . Callbacks . Title ( ctx ) ;
164
- else
165
- throw new NotSupportedException ( ) ;
166
- }
167
-
168
- [ JSInvokable ]
169
- public static string [ ] TooltipCallbacksLabel ( DotNetObjectReference < IChartConfig > config , decimal [ ] parameters )
170
- {
171
- var ctx = new CallbackGenericContext ( ( int ) parameters [ 0 ] , ( int ) parameters [ 1 ] , ( int ) parameters [ 2 ] ) ;
172
- if ( config . Value . Options is Options options )
173
- return options . Plugins . Tooltip . Callbacks . Label ( ctx ) ;
174
- else
175
- throw new NotSupportedException ( ) ;
176
- }
177
-
178
- [ JSInvokable ]
179
- public static string [ ] TicksCallback ( DotNetObjectReference < IChartConfig > config , string scaleName , decimal value , int index , decimal [ ] ticksValues )
176
+ /// <summary>
177
+ /// Clears the data.
178
+ /// </summary>
179
+ public async void ClearData ( )
180
180
{
181
- var ctx = new TicksCallbackContext ( value , index , ticksValues ) ;
182
- if ( config . Value . Options is Options options )
183
- return options . Scales [ scaleName ] . Ticks . Callback ( ctx ) ;
184
- else
185
- throw new NotSupportedException ( ) ;
181
+ await JSModule . ClearData ( Config . CanvasId ) ;
186
182
}
187
183
184
+ /// <summary>
185
+ /// Legends the labels filter.
186
+ /// </summary>
187
+ /// <param name="config">The configuration.</param>
188
+ /// <param name="item">The item.</param>
189
+ /// <param name="data">The data.</param>
190
+ /// <returns>System.Nullable<System.Boolean>.</returns>
188
191
[ JSInvokable ]
189
- public static bool ? LegendLabelsFilter ( DotNetObjectReference < IChartConfig > config , LegendItem item , Data data )
192
+ public static bool ? LegendLabelsFilter ( DotNetObjectReference < IChartConfig > config , LegendItem item , Data data )
190
193
{
191
194
var ctx = new LegendFilterContext ( item , data ) ;
192
195
if ( config . Value . Options is Options options )
@@ -195,8 +198,14 @@ public static string[] TicksCallback(DotNetObjectReference<IChartConfig> config,
195
198
throw new NotSupportedException ( ) ;
196
199
}
197
200
201
+ /// <summary>
202
+ /// Called when [click asynchronous].
203
+ /// </summary>
204
+ /// <param name="config">The configuration.</param>
205
+ /// <param name="ctx">The CTX.</param>
206
+ /// <returns>System.Threading.Tasks.Task<System.Threading.Tasks.ValueTask>.</returns>
198
207
[ JSInvokable ]
199
- public static async Task < ValueTask > OnClickAsync ( DotNetObjectReference < IChartConfig > config , CallbackGenericContext ctx )
208
+ public static async Task < ValueTask > OnClickAsync ( DotNetObjectReference < IChartConfig > config , CallbackGenericContext ctx )
200
209
{
201
210
//await OnChartClick.InvokeAsync(ctx);
202
211
@@ -206,25 +215,69 @@ public static async Task<ValueTask> OnClickAsync(DotNetObjectReference<IChartCon
206
215
return ValueTask . CompletedTask ;
207
216
}
208
217
218
+ /// <summary>
219
+ /// Called when [hover asynchronous].
220
+ /// </summary>
221
+ /// <param name="config">The configuration.</param>
222
+ /// <param name="ctx">The CTX.</param>
223
+ /// <returns>System.Threading.Tasks.Task<System.Threading.Tasks.ValueTask>.</returns>
209
224
[ JSInvokable ]
210
- public static async Task < ValueTask > OnHoverAsync ( DotNetObjectReference < IChartConfig > config , HoverContext ctx )
225
+ public static async Task < ValueTask > OnHoverAsync ( DotNetObjectReference < IChartConfig > config , HoverContext ctx )
211
226
{
212
227
if ( config . Value . Options is Options options && options . OnHoverAsync != null )
213
228
return options . OnHoverAsync ( ctx ) ;
214
229
else
215
230
return ValueTask . CompletedTask ;
216
231
}
217
232
233
+ /// <summary>
234
+ /// Called when [legend click asynchronous].
235
+ /// </summary>
236
+ /// <param name="config">The configuration.</param>
237
+ /// <param name="ctx">The CTX.</param>
238
+ /// <returns>System.Threading.Tasks.Task<System.Threading.Tasks.ValueTask>.</returns>
218
239
[ JSInvokable ]
219
- public static async Task < ValueTask > OnLegendClickAsync ( DotNetObjectReference < IChartConfig > config , LegendClickContext ctx )
240
+ public static async Task < ValueTask > OnLegendClickAsync ( DotNetObjectReference < IChartConfig > config ,
241
+ LegendClickContext ctx )
220
242
{
221
243
if ( config . Value . Options is Options options && options ? . Plugins ? . Legend ? . OnClickAsync != null )
222
244
return options . Plugins . Legend . OnClickAsync ( ctx ) ;
223
245
else
224
246
return ValueTask . CompletedTask ;
225
247
}
248
+
249
+ /// <summary>
250
+ /// Tickses the callback.
251
+ /// </summary>
252
+ /// <param name="config">The configuration.</param>
253
+ /// <param name="scaleName">Name of the scale.</param>
254
+ /// <param name="value">The value.</param>
255
+ /// <param name="index">The index.</param>
256
+ /// <param name="ticksValues">The ticks values.</param>
257
+ /// <returns>System.String[].</returns>
258
+ [ JSInvokable ]
259
+ public static string [ ] TicksCallback ( DotNetObjectReference < IChartConfig > config ,
260
+ string scaleName , decimal value , int index , decimal [ ] ticksValues )
261
+ {
262
+ var ctx = new TicksCallbackContext ( value , index , ticksValues ) ;
263
+ if ( config . Value . Options is Options options )
264
+ return options . Scales [ scaleName ] . Ticks . Callback ( ctx ) ;
265
+ else
266
+ throw new NotSupportedException ( ) ;
267
+ }
268
+
269
+ /// <summary>
270
+ /// Tickses the callback asynchronous.
271
+ /// </summary>
272
+ /// <param name="config">The configuration.</param>
273
+ /// <param name="scaleName">Name of the scale.</param>
274
+ /// <param name="value">The value.</param>
275
+ /// <param name="index">The index.</param>
276
+ /// <param name="ticksValues">The ticks values.</param>
277
+ /// <returns>System.Threading.Tasks.Task<System.String[]>.</returns>
226
278
[ JSInvokable ]
227
- public static async Task < string [ ] > TicksCallbackAsync ( DotNetObjectReference < IChartConfig > config , string scaleName , decimal value , int index , decimal [ ] ticksValues )
279
+ public static async Task < string [ ] > TicksCallbackAsync ( DotNetObjectReference < IChartConfig > config ,
280
+ string scaleName , decimal value , int index , decimal [ ] ticksValues )
228
281
{
229
282
var ctx = new TicksCallbackContext ( value , index , ticksValues ) ;
230
283
if ( config . Value . Options is Options options )
@@ -233,10 +286,38 @@ public static async Task<string[]> TicksCallbackAsync(DotNetObjectReference<ICha
233
286
throw new NotSupportedException ( ) ;
234
287
}
235
288
236
- #endregion JavaScript invokable functions
289
+ /// <summary>
290
+ /// Titles the callbacks.
291
+ /// </summary>
292
+ /// <param name="config">The configuration.</param>
293
+ /// <param name="parameters">The parameters.</param>
294
+ /// <returns>System.String[].</returns>
295
+ [ JSInvokable ]
296
+ public static string [ ] TitleCallbacks ( DotNetObjectReference < IChartConfig > config , decimal [ ] parameters )
297
+ {
298
+ var ctx = new CallbackGenericContext ( ( int ) parameters [ 0 ] , ( int ) parameters [ 1 ] , parameters [ 2 ] ) ;
299
+ if ( config . Value . Options is Options options )
300
+ return options . Plugins . Tooltip . Callbacks . Title ( ctx ) ;
301
+ else
302
+ throw new NotSupportedException ( ) ;
303
+ }
237
304
238
- public void Dispose ( )
305
+ /// <summary>
306
+ /// Tooltips the callbacks label.
307
+ /// </summary>
308
+ /// <param name="config">The configuration.</param>
309
+ /// <param name="parameters">The parameters.</param>
310
+ /// <returns>System.String[].</returns>
311
+ [ JSInvokable ]
312
+ public static string [ ] TooltipCallbacksLabel ( DotNetObjectReference < IChartConfig > config , decimal [ ] parameters )
239
313
{
314
+ var ctx = new CallbackGenericContext ( ( int ) parameters [ 0 ] , ( int ) parameters [ 1 ] , ( int ) parameters [ 2 ] ) ;
315
+ if ( config . Value . Options is Options options )
316
+ return options . Plugins . Tooltip . Callbacks . Label ( ctx ) ;
317
+ else
318
+ throw new NotSupportedException ( ) ;
240
319
}
320
+
321
+ #endregion JavaScript invokable functions
241
322
}
242
323
}
0 commit comments