Skip to content
Discussion options

You must be logged in to vote

You did not miss it: ticks.callback is not exposed by the current BlazorBootstrap chart API. The current ChartAxesTicks model contains the serializable styling options, but no Callback property. A JavaScript function also cannot be transferred as a normal .NET delegate through JSON interop.

A small JS interop helper is a workable solution for now. Give the chart a stable ID:

@inject IJSRuntime JS

<LineChart Id="percent-chart" @ref="lineChart" />

Add this to a JS file loaded after Chart.js/BlazorBootstrap:

window.setPercentYAxisTicks = (canvasId) => {
    const chart = Chart.getChart(canvasId);
    const ticks = chart?.options?.scales?.y?.ticks;
    if (!ticks) return;

    ticks.callback = 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kwon0408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants