Constructor
new scadavis(containeropt, iframeparamsopt, svgurlopt, paramsobjopt)
Must be created with the "new" keyword. (use scadavisInit when promise-based method preferred). E.g. var svgraph = new scadavis("div1", "", "https://svgurl.com/svgurl.svg");
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
container |
string |
<optional> |
ID of the container object. If empty or null the iframe will be appended to the body. |
iframeparams |
string |
<optional> |
Parameter string for configuring iframe (excluding id and src and sandbox) e.g. 'frameborder="0" height="250" width="250"'. |
svgurl |
string |
<optional> |
URL for the SVG file. |
paramsobj |
Object |
<optional> |
Alternatively parameters can be passed in an object. Example usage: var svgraph = new scadavis("div1", "", "https://svgurl.com/svgurl.svg"); |
- Source:
Methods
(static) enableAlarmFlash(alarmFlashEnabledopt)
Enable or disable alarm flash (objects blinking when alarmed).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
alarmFlashEnabled |
boolean |
<optional> |
true | Enable/disable global alarm flash. |
- Source:
(static) enableKeyboard(keyEnabledopt)
Enable or disable keyboard functions (zoom & pan).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keyEnabled |
boolean |
<optional> |
true | Enable/disable Pan tool. |
- Source:
(static) enableMouse(panEnabledopt, zoomEnabledopt)
Enable or disable pan and zoom via mouse.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
panEnabled |
boolean |
<optional> |
true | Enable/disable pan via mouse. |
zoomEnabled |
boolean |
<optional> |
true | Enable/disable zoom via mouse. |
- Source:
(static) enableTools(panEnabledopt, zoomEnabledopt)
Enable or disable pan and zoom tools.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
panEnabled |
boolean |
<optional> |
true | Enable/disable Pan tool. |
zoomEnabled |
boolean |
<optional> |
false | Enable/disable Zoom tool. |
- Source:
(static) getApiKey() → {string}
Recover the API Key.
- Source:
Returns:
API Key.
- Type
- string
(static) getComponentState() → {number}
Get the current state of the component.
- Source:
Returns:
0=not loaded, 1=loaded and ready for graphics, 2=SVG graphics processed and ready for data.
- Type
- number
(static) getComponentVersion() → {string}
Get SCADAvis.io Component Version.
- Source:
Returns:
SCADAvis.io Component Version.
- Type
- string
(static) getIframe() → {Object}
Get the DOM element of the iframe.
- Source:
Returns:
DOM element reference.
- Type
- Object
(static) getTagsList() → {string}
Get tags list from the loaded SVG graphics.
- Source:
Returns:
Tags list.
- Type
- string
(static) getValue(tag) → {number}
Get a value for a tag.
Parameters:
Name | Type | Description |
---|---|---|
tag |
Object | Tag name. |
- Source:
Returns:
Returns the value for the tag or null if not found.
- Type
- number
(static) getVersion() → {string}
Get SCADAvis.io API Version.
- Source:
Returns:
SCADAvis.io API Version.
- Type
- string
(static) hideWatermark()
Hides the watermark.
- Source:
(static) loadURL(svgurl)
Load the SVG synoptic display file from a SVG URL.
Parameters:
Name | Type | Description |
---|---|---|
svgurl |
string | The SVG URL. |
- Source:
(static) moveBy(dxopt, dyopt, animateopt)
Move the graphic. Multiple calls have cumulative effect.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
dx |
number |
<optional> |
0 | Horizontal distance. |
dy |
number |
<optional> |
0 | Vertical distance. |
animate |
boolean |
<optional> |
false | Animate or not. |
- Source:
(static) on(event, callback)
Set event listeners.
Parameters:
Name | Type | Description |
---|---|---|
event |
string | Event name, one of: "ready", "click" (the first parameter of callback is the element id). |
callback |
function | Callback function. |
- Source:
Returns:
True for valid event, false for invalid event name.
(static) refreshDisplay(valuesopt) → {Object}
Update values for tags to the component. Send all tags available. Work as a promise. Only available for version 2+.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
Object.<string, number> |
<optional> |
values in a object like { "tag1" : 1.0, "tag2": 1.2, "tag3": true }. |
- Source:
Returns:
Returns a promise. The promise resolves after the display refresh is completed.
- Type
- Object
(static) resetData()
Reset all data values and tags.
- Source:
(static) setColor(colorNumberopt, colorCodeopt)
Set color code for color shortcuts.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
colorNumber |
number |
<optional> |
Color shortcut number. |
colorCode |
string |
<optional> |
Color code. |
- Source:
(static) setColors(colorsTableopt)
Set color codes for color shortcuts.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
colorsTable |
Object.<number, string> |
<optional> |
Table of color numbers/Color codes. |
- Source:
(static) setMouseWheel(directionBackOutopt, blockEventPropagationopt)
Set direction of zoom bound to mouse wheel, and event propagation.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
directionBackOut |
boolean |
<optional> |
true | true=back/out, false=back/in. |
blockEventPropagation |
boolean |
<optional> |
true | Enable/disable wheel event propagation. |
- Source:
(static) setValue(tag, value, failedopt, alarmedopt, descriptionopt) → {bool}
Set a value for a tag. The component will be updated immediately if the component is ready for data.
Notice that updating the component at too many times per second can cause performance problems.
Preferably update many values using storeValue() then call updateValues() once (repeat after a second or more).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tag |
string | Tag name. | ||
value |
number | Value for the tag. | ||
failed |
bool |
<optional> |
false | True if value is bad or old, false or absent if value is good. |
alarmed |
bool |
<optional> |
false | True if value is alarmed, false or absent if value is normal. |
description |
string |
<optional> |
tag | Description. |
- Source:
Returns:
Returns true if the component was updated (true) or the value was buffered (false).
- Type
- bool
(static) storeValue(tag, value, failedopt, alarmedopt, descriptionopt) → {bool}
Store a value for a tag. The component will not be updated until called updateValues().
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tag |
string | Tag name. | ||
value |
number | Value for the tag. | ||
failed |
bool |
<optional> |
false | True if value is bad or old, false or absent if value is good. |
alarmed |
bool |
<optional> |
false | True if value is alarmed, false or absent if value is normal. |
description |
string |
<optional> |
tag | Description. |
- Source:
Returns:
- Returns true if the component is ready for data, false if not.
- Type
- bool
(static) updateValues(valuesopt) → {number}
Update values for tags to the component. Send all tags available. (use refreshDisplay when promise-based method preferred)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
Object.<string, number> |
<optional> |
values in a object like { "tag1" : 1.0, "tag2": 1.2, "tag3": true }. |
- Source:
Returns:
Returns request handle or null if not ready.
- Type
- number
(static) zoomTo(zoomLevelopt, targetopt, animateopt)
Apply zoom level. Multiple calls have cumulative effect.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
zoomLevel |
number |
<optional> |
1.1 | Zoom level. >1 zoom in, <1 zoom out. |
target |
string | Object |
<optional> |
{x:0,y:0} | Id of object to zoom in/out or x/y coordinates. |
animate |
boolean |
<optional> |
false | Animate or not. |
- Source:
(static) zoomToOriginal(animateopt)
Apply default zoom level/position.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
animate |
boolean |
<optional> |
false | Animate or not. |
- Source: