bernii / gauge.js

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

Guage labels as shown here http://bernii.github.io/gauge.js/ does not work out of the box. #220

Closed OmkarFatale closed 4 years ago

OmkarFatale commented 4 years ago

I added this to options

staticLabels: { font: "10px sans-serif", // Specifies font labels: [200, 230, 250, 220.1, 260, 300], // Print labels at these values color: "#111", // Optional: Label text color fractionDigits: 0 // Optional: Numerical precision. 0=round off. },

tried changing colors but no luck its showing this only.

download

kplindegaard commented 4 years ago

staticLabels don't work for Donut, only Gauge.

shahinlotfi commented 4 years ago

I can't get any labels to show when using the Donut, not even the "main" label shown in the example previews.

kplindegaard commented 4 years ago

Use the setTextField() method on the Dount object and provide the element you want.

For example, in your html you have a

   <div id="preview-textfield"></div>

Pass a ref to that directly after initializing your gauge/donut

// Initialize gauge
gauge.setTextField(document.getElementById("preview-textfield"));