bernii / gauge.js

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

'Gauge' is undefined #169

Closed nygkin closed 6 years ago

nygkin commented 6 years ago

when I use the system with just html it works fine (Below) (canvas id="headGauge" data-type="radial-gauge" data-width="400" data-height="400" data-units="Days" data-title="Heads"
data-value="<%=Heads %>" data-min-value="0" data-max-value="10" data-major-ticks="0,1,2,3,4,5,6,7,8,9,10" data-minor-ticks="2" data-stroke-ticks="false" data-highlights='[ { "from": 0, "to": 2.5, "color": "rgba(0,255,0,.15)" }, { "from": 2.5, "to": 4.5, "color": "rgba(255,255,0,.15)" }, { "from": 4.5, "to": 10, "color": "rgba(255,30,0,.25)" } ]' data-color-plate="#222" data-color-major-ticks="#f5f5f5" data-color-minor-ticks="#ddd" data-color-title="#fff" data-color-units="#ccc" data-color-numbers="#eee" data-color-needle-start="rgba(240, 128, 128, 1)" data-color-needle-end="rgba(255, 160, 122, .9)" data-value-box="true") (/canvas)

But if I try to access the library through JavaScript I get an error ('Gauge' is undefined). var g1 = new Gauge(document.getElementById('headGauge'));

Am I doing something wrong?

kplindegaard commented 6 years ago

From your html example code, it seems you are using Canvas Gauges and not gauge.js.