所以我想设置一个动态最大值。 函数“ UpdateVolume”将每秒更新一次int。 这是我的代码: Javascript:
function updateVolumen(volumen)
{
document.getElementById("gas").dataset.maxValue = volumen;
}
<div class="w3-display-bottomright" style="z-index:-5; bottom: 115; right: 15;">
<canvas id="gas" data-type="radial-gauge"
data-width="100"
data-height="100"
data-start-angle="20"
data-ticks-angle="140"
data-title="false"
data-value="0"
data-min-value="0"
data-max-value="0"
data-major-ticks="R,1"
data-border-outer-width=1.8
data-border-middle-width=1.8
data-color-border-outer="#ff0000"
data-color-border-outer-end="#ff0000"
data-minor-ticks="6"
data-stroke-ticks="false"
data-value-box="false"
data-animation="false"
data-highlights='[
{ "from": 0, "to": 15, "color": "rgba(255,0,0,.75)" }
]'
data-border-outer-width=1
data-border-middle-width=1
data-color-plate="#fff"
data-color-major-ticks="#000000"
data-color-minor-ticks="#000000"
data-font-numbers-size="38"
data-color-title="#000000"
data-color-units="#000000"
data-color-numbers="#000000"
></canvas>
但是最大值始终为“ 0”