Skip to content

Commit 475b1c9

Browse files
committedAug 2, 2024·
Reorganize some files
1 parent 00f2d81 commit 475b1c9

12 files changed

+210
-124
lines changed
 

‎ChartjsDemo/ChartjsDemo.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.18" />
12-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.18" PrivateAssets="all" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" />
12+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" PrivateAssets="all" />
1313
<PackageReference Include="PSC.Blazor.Components.CodeSnippet" Version="1.0.3" />
1414
</ItemGroup>
1515

‎src/Chart.razor.cs

+122-41
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,22 @@ public partial class Chart : IDisposable
112112

113113
#region Public functions
114114

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>
115121
public async void AddData(List<string?> labels, int datasetIndex, List<decimal?> data)
116122
{
117123
await JSModule.AddData(Config.CanvasId, labels, datasetIndex, data);
118124
}
119125

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>
125131
public async void AddDataset<T>(T dataset) where T : class
126132
{
127133
await JSModule.AddNewDataset(Config.CanvasId, dataset);
@@ -131,7 +137,14 @@ public async void AddDataset<T>(T dataset) where T : class
131137

132138
#endregion Parameters
133139

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)
135148
{
136149
if (Config != null) {
137150
if (OldConfig == null || Config != OldConfig) {
@@ -145,7 +158,12 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
145158
}
146159
}
147160

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)
149167
{
150168
if (Config.Options is Options { OnMouseOutAsync: { } } options)
151169
return options.OnMouseOutAsync(mouseEventArgs);
@@ -155,38 +173,23 @@ private ValueTask OnMouseOutAsync(MouseEventArgs mouseEventArgs)
155173

156174
#region JavaScript invokable functions
157175

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()
180180
{
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);
186182
}
187183

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&lt;System.Boolean&gt;.</returns>
188191
[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)
190193
{
191194
var ctx = new LegendFilterContext(item, data);
192195
if (config.Value.Options is Options options)
@@ -195,8 +198,14 @@ public static string[] TicksCallback(DotNetObjectReference<IChartConfig> config,
195198
throw new NotSupportedException();
196199
}
197200

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&lt;System.Threading.Tasks.ValueTask&gt;.</returns>
198207
[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)
200209
{
201210
//await OnChartClick.InvokeAsync(ctx);
202211

@@ -206,25 +215,69 @@ public static async Task<ValueTask> OnClickAsync(DotNetObjectReference<IChartCon
206215
return ValueTask.CompletedTask;
207216
}
208217

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&lt;System.Threading.Tasks.ValueTask&gt;.</returns>
209224
[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)
211226
{
212227
if (config.Value.Options is Options options && options.OnHoverAsync != null)
213228
return options.OnHoverAsync(ctx);
214229
else
215230
return ValueTask.CompletedTask;
216231
}
217232

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&lt;System.Threading.Tasks.ValueTask&gt;.</returns>
218239
[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)
220242
{
221243
if (config.Value.Options is Options options && options?.Plugins?.Legend?.OnClickAsync != null)
222244
return options.Plugins.Legend.OnClickAsync(ctx);
223245
else
224246
return ValueTask.CompletedTask;
225247
}
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&lt;System.String[]&gt;.</returns>
226278
[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)
228281
{
229282
var ctx = new TicksCallbackContext(value, index, ticksValues);
230283
if (config.Value.Options is Options options)
@@ -233,10 +286,38 @@ public static async Task<string[]> TicksCallbackAsync(DotNetObjectReference<ICha
233286
throw new NotSupportedException();
234287
}
235288

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+
}
237304

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)
239313
{
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();
240319
}
320+
321+
#endregion JavaScript invokable functions
241322
}
242323
}

‎src/ChartJsInterop.cs

+40-4
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,74 @@
44

55
namespace PSC.Blazor.Components.Chartjs
66
{
7+
/// <summary>
8+
/// Class ChartJsInterop.
9+
/// </summary>
710
public class ChartJsInterop
811
{
12+
/// <summary>
13+
/// The module task
14+
/// </summary>
915
private readonly Lazy<Task<IJSObjectReference>> moduleTask;
1016

17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="ChartJsInterop"/> class.
19+
/// </summary>
20+
/// <param name="jsRuntime">The js runtime.</param>
1121
public ChartJsInterop(IJSRuntime jsRuntime)
1222
{
1323
moduleTask = new(() => jsRuntime.InvokeAsync<IJSObjectReference>("import",
1424
"./_content/PSC.Blazor.Components.Chartjs/Chart.js").AsTask());
1525
}
1626

27+
/// <summary>
28+
/// Setups the specified dot net object reference.
29+
/// </summary>
30+
/// <param name="dotNetObjectRef">The dot net object reference.</param>
31+
/// <param name="Config">The configuration.</param>
32+
/// <returns>ValueTask.</returns>
1733
public async ValueTask Setup(DotNetObjectReference<IChartConfig> dotNetObjectRef, IChartConfig Config)
1834
{
1935
var module = await moduleTask.Value;
2036
await module.InvokeVoidAsync("chartSetup", Config.CanvasId, dotNetObjectRef, Config);
2137
}
2238

39+
/// <summary>
40+
/// Adds the data.
41+
/// </summary>
42+
/// <param name="CanvasId">The canvas identifier.</param>
43+
/// <param name="labels">The labels.</param>
44+
/// <param name="datasetIndex">Index of the dataset.</param>
45+
/// <param name="data">The data.</param>
46+
/// <returns>ValueTask.</returns>
2347
public async ValueTask AddData(string CanvasId, List<string> labels, int datasetIndex, List<decimal?> data)
2448
{
2549
var module = await moduleTask.Value;
2650
await module.InvokeVoidAsync("addData", CanvasId, labels, datasetIndex, data);
2751
}
2852

29-
public async ValueTask ClearData(string CanvasId)
53+
/// <summary>
54+
/// Adds the new dataset.
55+
/// </summary>
56+
/// <typeparam name="T"></typeparam>
57+
/// <param name="CanvasId">The canvas identifier.</param>
58+
/// <param name="dataset">The dataset.</param>
59+
/// <returns>ValueTask.</returns>
60+
public async ValueTask AddNewDataset<T>(string CanvasId, T dataset) where T : class
3061
{
3162
var module = await moduleTask.Value;
32-
await module.InvokeVoidAsync("clearData", CanvasId);
63+
await module.InvokeVoidAsync("addNewDataset", CanvasId, dataset);
3364
}
3465

35-
public async ValueTask AddNewDataset<T>(string CanvasId, T dataset) where T : class
66+
/// <summary>
67+
/// Clears the data.
68+
/// </summary>
69+
/// <param name="CanvasId">The canvas identifier.</param>
70+
/// <returns>ValueTask.</returns>
71+
public async ValueTask ClearData(string CanvasId)
3672
{
3773
var module = await moduleTask.Value;
38-
await module.InvokeVoidAsync("addNewDataset", CanvasId, dataset);
74+
await module.InvokeVoidAsync("clearData", CanvasId);
3975
}
4076
}
4177
}

‎src/Models/Common/AxesTime.cs

-41
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/// </summary>
66
public sealed class AxesTime
77
{
8-
98
/// <summary>
109
/// Get or set the source.
1110
/// </summary>
@@ -75,45 +74,5 @@ public sealed class AxesTime
7574
[JsonPropertyName("minUnit")]
7675
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
7776
public string? MinUnit { get; set; }
78-
79-
}
80-
81-
public sealed class AxesTimeFormats
82-
{
83-
[JsonPropertyName("millisecond")]
84-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
85-
public string? Millisecond{ get; set; }
86-
87-
[JsonPropertyName("second")]
88-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
89-
public string? Second { get; set; }
90-
91-
[JsonPropertyName("minute")]
92-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
93-
public string? Minute { get; set; }
94-
95-
[JsonPropertyName("hour")]
96-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
97-
public string? Hour { get; set; }
98-
99-
[JsonPropertyName("day")]
100-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
101-
public string? Day { get; set; }
102-
103-
[JsonPropertyName("week")]
104-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
105-
public string? Week { get; set; }
106-
107-
[JsonPropertyName("month")]
108-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
109-
public string? Month { get; set; }
110-
111-
[JsonPropertyName("quarter")]
112-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
113-
public string? Quarter { get; set; }
114-
115-
[JsonPropertyName("year")]
116-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
117-
public string? Year { get; set; }
11877
}
11978
}

‎src/Models/Common/Colors.cs

-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ public class Colors
2525
[JsonPropertyName("forceOverride")]
2626
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2727
public bool? ForceOverride { get; set; }
28-
2928
}
3029
}

‎src/Models/Common/StringEnums/StepMode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;

‎src/Models/Common/Ticks.cs

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class Ticks
1616
[JsonInclude]
1717
[JsonPropertyName("hasCallback")]
1818
public bool HasCallback => Callback != null;
19+
1920
/// <summary>
2021
/// Gets a value indicating whether this instance has callback.
2122
/// </summary>
@@ -25,6 +26,7 @@ public class Ticks
2526
[JsonInclude]
2627
[JsonPropertyName("hasAsyncCallback")]
2728
public bool HasAsyncCallback => CallbackAsync != null;
29+
2830
/// <summary>
2931
/// Gets or sets the callback.
3032
/// </summary>
@@ -33,6 +35,7 @@ public class Ticks
3335
/// </value>
3436
[JsonIgnore]
3537
public Func<TicksCallbackContext, string[]>? Callback { get; set; }
38+
3639
/// <summary>
3740
/// Gets or sets the callback.
3841
/// </summary>
@@ -80,6 +83,10 @@ public CrossAlign? CrossAlign
8083
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
8184
public string? CrossAlignString { get; set; }
8285

86+
/// <summary>
87+
/// Gets or sets the font.
88+
/// </summary>
89+
/// <value>The font.</value>
8390
[JsonPropertyName("font")]
8491
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
8592
public Font? Font { get; set; }

‎src/Models/Line/LineDataType.cs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/// </summary>
66
public class LineDataType
77
{
8-
98
/// <summary>
109
/// Gets or sets the x value.
1110
/// </summary>

‎src/Models/Line/LineDataset.cs

-18
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,6 @@ public StepMode? StepMode
140140
}
141141
private StepMode? _stepMode;
142142

143-
/// <summary>
144-
/// Gets or sets the step mode.
145-
/// </summary>
146-
/// <value>
147-
/// The step mode.
148-
/// </value>
149-
[JsonIgnore]
150-
public StepMode? StepMode
151-
{
152-
get => _stepMode;
153-
set
154-
{
155-
_stepMode = value;
156-
SteppedString = _stepMode.Value;
157-
}
158-
}
159-
private StepMode? _stepMode;
160-
161143
/// <summary>
162144
/// Gets or sets the stepped string.
163145
/// </summary>

‎src/PSC.Blazor.Components.Chartjs.csproj

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
23
<PropertyGroup>
3-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
45
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
56
<Description>ChartJs component for Blazor. Compatible with client-side and server-side Blazor applications.</Description>
67
<PackageIcon>psc_logo.png</PackageIcon>
@@ -17,9 +18,11 @@
1718
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1819
<GenerateDocumentationFile>True</GenerateDocumentationFile>
1920
</PropertyGroup>
21+
2022
<ItemGroup>
2123
<Content Include="psc_ico.ico" />
2224
</ItemGroup>
25+
2326
<ItemGroup>
2427
<None Include="..\LICENSE">
2528
<Pack>True</Pack>
@@ -30,19 +33,24 @@
3033
<PackagePath>\</PackagePath>
3134
</None>
3235
</ItemGroup>
36+
3337
<ItemGroup>
3438
<SupportedPlatform Include="browser" />
3539
</ItemGroup>
40+
41+
<ItemGroup>
42+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6" />
43+
</ItemGroup>
44+
3645
<ItemGroup>
3746
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
3847
</ItemGroup>
48+
3949
<ItemGroup>
4050
<None Update="psc_logo.png">
4151
<Pack>True</Pack>
4252
<PackagePath>\</PackagePath>
4353
</None>
4454
</ItemGroup>
45-
<ItemGroup>
46-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.18" />
47-
</ItemGroup>
48-
</Project>
55+
56+
</Project>

‎src/Util/ColorUtil.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using System.Globalization;
1+
// ***********************************************************************
2+
// Assembly : PSC.Blazor.Components.Chartjs
3+
// Author : Enrico Rossini
4+
// Created : 03-07-2024
5+
//
6+
// Last Modified By : enric
7+
// Last Modified On : 03-07-2024
8+
// ***********************************************************************
9+
// <copyright file="ColorUtil.cs" company="PSC.Blazor.Components.Chartjs">
10+
// Copyright(c) 2019 Marius Muntean
11+
// Copyright (c) 2021 Joel L.
12+
// Enrico Rossini - PureSourceCode.com
13+
// </copyright>
14+
// <summary></summary>
15+
// ***********************************************************************
16+
using System.Globalization;
217

318
namespace PSC.Blazor.Components.Chartjs.Util
419
{

‎src/wwwroot/Chart.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export function chartSetup(id, dotnetConfig, jsonConfig) {
189189
var scales = Object.keys(config.options.scales);
190190
for (let scale of scales) {
191191
if (config.options.scales[scale]?.ticks?.hasCallback) {
192+
config.options.scales[scale].ticks.hasCallback = undefined;
192193
config.options.scales[scale].ticks.hasCallback = undefined;
193194
config.options.scales[scale].ticks.callback = function (value, index, ticks) {
194195
return DotNet.invokeMethod('PSC.Blazor.Components.Chartjs', 'TicksCallback',
@@ -264,6 +265,12 @@ export function addData(id, label, dataset, data) {
264265
chart.update();
265266
}
266267

268+
export function addNewDataset(id, dataset) {
269+
var chart = Chart.getChart(id);
270+
chart.data.datasets.push(dataset);
271+
chart.update();
272+
}
273+
267274
export function clearData(id) {
268275
var chart = Chart.getChart(id);
269276

@@ -274,11 +281,4 @@ export function clearData(id) {
274281
});
275282

276283
chart.update();
277-
}
278-
279-
280-
export function addNewDataset(id, dataset) {
281-
var chart = Chart.getChart(id);
282-
chart.data.datasets.push(dataset);
283-
chart.update();
284-
}
284+
}

0 commit comments

Comments
 (0)
Please sign in to comment.