Wijmo UI for the Web
Use a Gradient for the Face
Show AllShow All
Hide AllHide All

You can create any face for your gauge using colors, Raphael drawing, or even an image.

Building on the Quick Start example, you can draw circles with gradient colors to use for the face of the gauge using the face option.

  1. In the <head> section of your HTML file, replace the script that includes the document ready function with this one, which uses Raphael drawing to create a template function that draws two circles, one inside the other. The argument that we name ui in the example is a JSON object. This object has a canvas, which is a Raphael paper object, and we use the circle method of the Raphael paper that takes three parameters: x, y, and radius. See the Raphael documentation for more information. We also set the radius to 185 pixels to render the labels inside the circles.

    Drop down and copy script to paste in <head> section

  2. No changes are necessary in the <body> section of your HTML file. The basic <div> tag is sufficient to create the gauge.
  3. Save your HTML file and open it in a browser. The gauge appears like the one in the live widget below, with the dinner plate appearing as the face of the gauge.

See Also

Widgets

Reference

 
Support Options