1. Prepare the SVG file. You can build your own from scratch, follow some tutorial such as:
Or customize this file:
Or find and download some other one:
2. Using the SCADAvis.io Editor, select only the needle object (you may need to ungroup objects).
Adjust the center of rotation for the object: SHIFT+S and drag the small cross.
3. Right-click the needle and select "Object Properties", choose "Rotate", put
TAG1 in the "Tag"
field. In the "Min" and "Max" fields put the values for the measurement that will correspond to 0 and 360
degress of rotation.
E.g.: 0 and 120. Save the file somewhere in a server.
4. Use the SCADAvis.io Synoptic API to render de the SVG file and pass some values.
scadavisInit( {
svgurl: "https://raw.githubusercontent.com/riclolsen/displayfiles/master/speedometer.svg"
}).then(sv => {
sv.enableMouse(true, true);
sv.setValue("TAG1", 0);
// update at each .25 seconds
setInterval( function() {
var v = Math.random()*10-2.5*sv.getValue("TAG1")/60 +sv.getValue("TAG1");
if ( v < 0 ) v = 0;
if (v > 120) v = 120;
sv.setValue("TAG1", v);
}, 250);
})