bernii / gauge.js

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

demo link in readme is broken #249

Closed raako71 closed 2 years ago

raako71 commented 2 years ago

doesnt link to https://bernii.github.io/gauge.js/

sidtupper commented 2 years ago

I'm having difficulty making the gauge template work, using node.js to serve sensor data. index.html and dist/gauge.js are in the server root directory. The thing I'm stuck on is connecting the gauge to a canvas. I would be grateful for comments on this code:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>gauge</title>

<script>
src="dist/gauge.js"
var opts = {
  angle: 0.15, /// The span of the gauge arc
  lineWidth: 0.44, // The line thickness
  pointer: {
    length: 0.9, // Relative to gauge radius
    strokeWidth: 0.035 // The thickness
  },
  colorStart: '#6FADCF',   // Colors
  colorStop: '#8FC0DA',    // just experiment with them
  strokeColor: '#E0E0E0'   // to see which ones work best for you
};
var target = document.getElementById('demo'); // your canvas element
var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!

document.getElementById("preview-textfield").className = "preview-textfield";
gauge.setTextField(document.getElementById("preview-textfield"));

gauge.maxValue = 3000; // set max gauge value
gauge.setMinValue(0);  // set min value
gauge.set(1250); // set actual value
gauge.animationSpeed = 32;
</script>

</head>
<body>
<div id="preview-textfield"></div>
<canvas id="demo" width="200" height="200" style="border:1px solid #000000"></canvas>
</body>
</html>
kplindegaard commented 2 years ago

@sidtupper, see #252.

kplindegaard commented 2 years ago

Fixed the link.