bernii / gauge.js

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

Help for a noob :) #15

Closed thecatz closed 11 years ago

thecatz commented 11 years ago

Hello i've trouble to display the gauge can someone tel me what are going wrong on my code please? ( have replace here "< " with "( " to display the code)

thx

(html)
(head)


(head)
(body)
(canvas id="foo") (/canvas)

(/body)
(/html)

bernii commented 11 years ago

Hi @thecatz ! There are couple things that could be improved to make it work:

  1. Maybe that's just a misspelling but you have no closing tag for head ( you've got two (head), where one should be (/head)
  2. No end tag for (script)
  3. No gauge JS lib include! - You would get 'Uncaught ReferenceError: Gauge is not defined' in your web browser console if the rest was right.
  4. If you want to place your JS inside the (head) content you need to load it after gauge.js and canvas (which is in the body) is loaded. To do this you can use window.onload event (check out the html file linked below and http://stackoverflow.com/a/807895)

Fully working JS fiddle with your code: http://jsfiddle.net/berni/yzy8G/ Sample HTML page with your code: http://extensa.pl/projekty/gh/gauge_issue1.html

thecatz commented 11 years ago

thx for your help