bernii / gauge.js

100% native and cool looking JavaScript gauge
MIT License
1.42k stars 391 forks source link

Number Not displaying on top of Gauge #243

Closed Waqar06 closed 2 years ago

Waqar06 commented 3 years ago

The number not displaying on top of the gauge guage as shows in the demo.

austenstone commented 2 years ago

The demo uses a div to show the number.

<div id="preview-textfield" style="font-size: 24px;">1,250</div>
#preview-textfield {
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 2em;
    font-weight: bold;
    color: black;
    font-family: 'Amaranth', sans-serif;
}
gauge.setTextField(document.getElementById("preview-textfield"));

The gauge should now update the field for you.

BaseGauge.prototype.setTextField = function(textField, fractionDigits) {
    return this.textField = textField instanceof TextRenderer ? textField : new TextRenderer(textField, fractionDigits);
};
Waqar06 commented 2 years ago

Thank you