Skip to content

Commit a6435bf

Browse files
ipax77Joelius300
andauthored
Avoid error when using ticks in single-scale charts without specifying callback (#171)
Single-scale charts are radar and polar area. Co-authored-by: Joel Liechti <52202086+Joelius300@users.noreply.github.com>
1 parent de311f7 commit a6435bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ChartJs.Blazor/Interop/TypeScript/ChartJsInterop.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ class ChartJsInterop {
246246

247247
if (config.options?.scale?.ticks) {
248248
config.options.scale.ticks.callback = this.getMethodHandler(<IMethodHandler>config.options.scale.ticks.callback, undefined);
249+
250+
if (!config.options.scale.ticks.callback) {
251+
delete config.options.scale.ticks.callback; // undefined != deleted, Chart.js throws an error if it's undefined so we have to delete it
252+
}
249253
}
250254
}
251255

0 commit comments

Comments
 (0)