bernii / gauge.js

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

Custom staticLabels #182

Open amomsi opened 6 years ago

amomsi commented 6 years ago

Can you improve staticLabels to have the ability to display custom static labels instead of displaying only values. So for example I can provide: staticLabels: { font: '10px sans-serif', // Specifies font labels: [{ label: 'Foo', value: 10 }, { label: 'Bar', value: 50 }], // Print labels at these values color: '#000000', // Optional: Label text color fractionDigits: 0, // Optional: Numerical precision. 0=round off. }, Then in output I have displayed 'Foo' at value 10 and 'Bar' at value 50. Looking at the code it seems that you thought about that (there is a check if "labels" objects contain a 'label' attribute). Thanks,

git195 commented 5 years ago

Hi, It will be great if above updates can be provided. My requirement is to show text labels.

i.e. staticLabels: { font: "15px sans-serif", // Specifies font labels: ["Poor", "Fair", "good", "Excellent"], // Print labels at these values color: "#000000" // Optional: Label text color }

but this do not work.

guze0001 commented 4 years ago

I have added that functionality: adding text label functionality #228