bernii/gauge.js

Please help a noob, I have heard that I need to include lib so I don't get Guage is not defined error!

dan953 opened this issue · 1 comments

Hello, I am receiving the error, "Guage is not defined" when I run the code below. I was reading past issues and saw that I need to include lib or something. Any help will be appreciated

HTML
`

<script src="http://bernii.github.com/gauge.js/dist/gauge.js"></script> <script> var opts = { angle: 0.15, // The span of the gauge arc lineWidth: 0.44, // The line thickness radiusScale: 1, // Relative radius pointer: { length: 0.6, // // Relative to gauge radius strokeWidth: 0.035, // The thickness color: '#000000' // Fill color }, limitMax: false, // If false, max value increases automatically if value > maxValue limitMin: false, // If true, the min value of the gauge will be fixed colorStart: '#6FADCF', // Colors colorStop: '#8FC0DA', // just experiment with them strokeColor: '#E0E0E0', // to see which ones work best for you generateGradient: true, highDpiSupport: true, // High resolution support }; var target = document.getElementById('cpuGauge'); // your canvas element var gauge = new Gauge(target).setOptions(opts); // create sexy gauge! gauge.maxValue = 3000; // set max gauge value gauge.setMinValue(0); // Prefer setter over gauge.minValue = 0 gauge.animationSpeed = 32; // set animation speed (32 is default value) gauge.set(1500); // set actual value </script>
</body>
`
qroft commented

Hi Dan,
the first thing i would try is to see if the plugin is really loaded. For this simply load the page where you use the plugin and press CTRL + U to get the source code. When you have the code, find the line where you have implemented the script.
By what you have posted, it seems like you are trying to implement it directly from github. Apart of the fact that this is not such a great idea, if you click on said link in your code, what happens?
If you can see the gauge.min.js code then the plugin is implemented, otherwise not.

The best thing would be to download the whole MASTER from this Github folder and put that gauge.min.js file somewhere
within your project and call it from there.