How do you update a canvas in a razor page

Viewed 151

not sure how I would do this, this javasript Gauge shows but not updating new currentCount also wondering if there a way to create a gauge all in c# to work in this frame work

@page "/counter"

<h1>Counter</h1>

<p>Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
    private int currentCount = 0;

    private void IncrementCount()
    {
        currentCount++;
    }
}

<canvas data-type="radial-gauge" id="moisture_g"
        data-major-ticks="0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100"
        data-title="Moisture"
        data-units="m"
        data-width="156"
        data-height="156"
        data-value-int="0"
        data-value-dec="0"
        data-min-value="0"
        data-value="{@currentCount}"
        data-highlights="false">
</canvas>
0 Answers
Related