gauge_demo.js 937B

12345678910111213141516171819202122
  1. var opts = {
  2. lines: 12, // The number of lines to draw
  3. angle: 0, // The length of each line
  4. lineWidth: 0.4, // The line thickness
  5. pointer: {
  6. length: 0.75, // The radius of the inner circle
  7. strokeWidth: 0.042, // The rotation offset
  8. color: '#1D212A' // Fill color
  9. },
  10. limitMax: 'false', // If true, the pointer will not go past the end of the gauge
  11. colorStart: '#1ABC9C', // Colors
  12. colorStop: '#1ABC9C', // just experiment with them
  13. strokeColor: '#F0F3F3', // to see which ones work best for you
  14. generateGradient: true
  15. };
  16. var target = document.getElementById('foo'); // your canvas element
  17. var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!
  18. gauge.maxValue = 5000; // set max gauge value
  19. gauge.animationSpeed = 32; // set animation speed (32 is default value)
  20. gauge.set(3200); // set actual value
  21. gauge.setTextField(document.getElementById("gauge-text"));