Custom SCADA Screens and 3D Designs with SVG

Note: This guide provides the core integration templates required to develop custom components and full-screen interfaces for both Page (HtmlContent object) and Screen (WebView2 object) environments in Wise SCADA.

Wise SCADA offers the HtmlContent object on browser-accessible HTML5 Pages and the WebView2 object on desktop Screens. While this capability is commonly used to create individual custom SVG symbols (such as valves, pumps, or gauges), it is not limited to standalone components. Because these editors natively execute HTML5, CSS, JavaScript, and WebGL alongside SVG, you can build complete, animated operator screens connected to real SCADA tags (and even interactive 3D SCADA designs) without relying on any external libraries.

This article summarizes what can be achieved through a four-page water distribution and booster station sample project, then shares the essential reference code structures so you can build your own screens either manually or by providing these templates to your preferred AI assistant.

What Can Be Built with This Approach?

The sample project is linked to a process simulation running synchronously every 100 ms in Wise SCADA’s C# script engine. Page navigation buttons are built with Wise SCADA’s native buttons, while the entire visual and interactive interface inside each page is developed through the HtmlContent and WebView2 editors.

  • Pump Station (Page / HtmlContent): Live flow, header pressure, motor power, and tank level KPI cards; an animated hydraulic circuit schematic; an interactive pump assembly inspection view that separates and reassembles individual components (Casing, Impeller, Shaft, Bearing, Motor); operating mode, pump, and valve controls; a six-stage shift simulator; and live trend and event logs.
  • Network Overview (Page / HtmlContent): An isometric network diagram branching from the main pump station to Residential, Industrial, and City Centre zones, complete with district-level detail inspection, demand setpoint adjustments, and pump speed controls.
  • Shift Analysis (Page / HtmlContent): Supply-demand balance on a shared time axis, header pressure plotted against its target band, pump duty history, and an interactive operator event list.
  • Booster Hall 3D (Page / HtmlContent and Screen / WebView2): An interactive 3D plant model built with pure WebGL (and a 2D Canvas software fallback for unsupported environments) with zero external 3D libraries or internet dependencies. It includes orbit and free-camera controls, clickable equipment selection, section views (Exterior, Tank cutaway, Filter internals), flow path highlighting, and live level and flow animations driven by real SCADA tags.

Page (HtmlContent) and Screen (WebView2) Communication Summary

FeaturePage (HtmlContent)Screen (WebView2)
Runtime Environment Web browser (HTML5)Desktop SCADA application
Tag Declaration<!–WISE_TAGS […] WISE_TAGS–> or / <!–WISE_TAGS […] WISE_TAGS–> / in JS<!–WISE_TAGS […] WISE_TAGS–>
Live Listening (Subscription)function tagChanged(symbol, value, initial)window.WiseSvg?.subscribeTag(“TagName”, value => { … })
On-Demand Readawait TagRead(“TagName”)window.WiseSvg?.getTag(“TagName”)
Tag Writeawait TagSet(“TagName”, value)window.chrome.webview.postMessage(…) (handled by a Screen_Load C# script)
DOM Selectionelement.querySelector(…) and data-* attributes for component scopingdocument.getElementById(…) or document.querySelector(…) inside the isolated document

1. Tag Read and Write Templates for Page (HtmlContent)

Depending on your use case, HtmlContent lets you communicate with SCADA tags using either subscription-based updates or on-demand reads and writes.

A. Single Tag Read and Write via Subscription

Whenever the declared tag changes on the SCADA side, tagChanged is invoked automatically. The document.activeElement !== input check prevents incoming live updates from overwriting what the operator is currently typing into the input field.

HTML
<!--WISE_TAGS ["UintTag"] WISE_TAGS-->

<input data-value name="subscriptionValue">
<button data-set>Set</button>

<script>
const input = element.querySelector("[data-value]");

function tagChanged(symbol, value) {
    if (document.activeElement !== input)
        input.value = value;
}

element.querySelector("[data-set]").onclick = async function () {
    await TagSet("UintTag", Number(input.value));
};
</script>
B. Multiple Tag Read via Subscription

To listen to multiple tags within the same component, add all tag names to the WISE_TAGS array and route incoming updates inside tagChanged using the symbol parameter. Whenever writing is needed, the same TagSet approach shown above applies.

HTML
<!--WISE_TAGS ["UintTag", "Temperature", "MotorRunning"] WISE_TAGS-->

<div>Counter: <span data-counter></span></div>
<div>Temperature: <span data-temperature></span></div>
<div>Motor: <span data-motor></span></div>

<script>
function tagChanged(symbol, value) {
    switch (symbol) {
        case "UintTag":
            element.querySelector("[data-counter]").textContent = value;
            break;
        case "Temperature":
            element.querySelector("[data-temperature]").textContent = value;
            break;
        case "MotorRunning":
            element.querySelector("[data-motor]").textContent =
                String(value).toLowerCase() === "true" ? "Running" : "Stopped";
            break;
    }
}
</script>
C. Read and Write Without Subscription (TagRead / TagSet)

For configuration or parameter panels that do not require continuous live updates, you can omit the WISE_TAGS subscription and use TagRead and TagSet strictly on demand.

HTML
<input data-value name="readSetValue">
<button data-read>Read</button>
<button data-set>Set</button>

<script>
(async function () {
    const input = element.querySelector("[data-value]");

    async function readValue() {
        input.value = await TagRead("UintTag");
    }

    element.querySelector("[data-read]").onclick = readValue;

    element.querySelector("[data-set]").onclick = async function () {
        await TagSet("UintTag", Number(input.value));
        await readValue();
    };

    await readValue();
})();
</script>

2. Testing Tag Flow in the Console and the initial Parameter

Before connecting a complex graphic or dashboard, you can verify that tag names and incoming value formats match your expectations in the browser developer console. When placing the tag declaration directly inside JavaScript code, wrap it in / … / comment delimiters.

The third parameter of tagChanged, initial, lets you distinguish between the initial value read when the page first loads (true) and a new runtime value change (false).

JavaScript
/* <!--WISE_TAGS ["UintTag"] WISE_TAGS--> */

function tagChanged(symbol, value, initial) {
    console.log("Tag:", symbol, "Value:", value, "Initial:", initial);
}

3. Dynamic SVG Object Bound to a Live Tag (Page / HtmlContent)

Rather than displaying tag values only as text, you can bind them directly to SVG attributes (such as y, height, transform, or fill) to create dynamic tanks, level bars, valves, and process schematics.

The example below clamps UintTag between 0 and 100 and fills a level indicator smoothly from bottom to top:

HTML
<!--WISE_TAGS ["UintTag"] WISE_TAGS-->

<svg viewBox="0 0 120 140" style="width:100%;height:100%;">
    <rect x="10" y="10" width="100" height="100" fill="#ddd"/>
    <rect data-level x="10" y="110" width="100" height="0" fill="#2196f3"/>
    <text data-value x="60" y="135" text-anchor="middle">0%</text>
</svg>

<script>
function tagChanged(symbol, value) {
    const level = Math.max(0, Math.min(100, Number(value)));
    const fill = element.querySelector("[data-level]");
    fill.setAttribute("y", 110 - level);
    fill.setAttribute("height", level);
    element.querySelector("[data-value]").textContent = level + "%";
}
</script>

4. Tag-Driven SVG Animation in Desktop Screens (Screen / WebView2)

On desktop Screens, the WebView2 object exposes window.WiseSvg?.subscribeTag(…) for live tag updates and window.WiseSvg?.getTag(…) for on-demand reads.

The following example rotates a fan impeller based on BoolTag. Because SVG’s built-in animateTransform is controlled via pauseAnimations() and unpauseAnimations(), the fan stops naturally at its current angle instead of snapping back to its starting position:

HTML
<!--WISE_TAGS ["BoolTag"] WISE_TAGS-->
<svg id="fan" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 200 200" width="100%" height="100%" style="display:block;">
    <circle cx="100" cy="100" r="90" fill="#263238"/>

    <g fill="#29b6f6">
        <path d="M100 90 C60 40 90 10 115 30 C135 50 115 75 100 90"/>
        <path d="M110 100 C160 60 190 90 170 115 C150 135 125 115 100 100"/>
        <path d="M100 110 C140 160 110 190 85 170 C65 150 85 125 100 110"/>
        <path d="M90 100 C40 140 10 110 30 85 C50 65 75 85 90 100"/>
        <animateTransform attributeName="transform" type="rotate"
                          from="0 100 100" to="360 100 100"
                          dur="5s" repeatCount="indefinite"/>
    </g>

    <circle cx="100" cy="100" r="15" fill="#eceff1"/>
</svg>

<script>
    (() => {
        const fan = document.getElementById('fan');
        fan.pauseAnimations();

        window.WiseSvg?.subscribeTag('BoolTag', value => {
            if (value === true) {
                fan.unpauseAnimations();
            } else {
                fan.pauseAnimations();
            }
        });
    })();
</script>

Key Tips and Rules for AI-Assisted Screen Generation

If you want to provide the code samples in this article to your own AI assistant to generate custom screens, indicators, or 3D scenes for your project, include the following rules in your prompt to ensure the output works cleanly on the first try:

  • Tag Declarations Must Match Exactly: Every tag that uses live subscription must be declared accurately using <!–WISE_TAGS [“Tag1”, “Tag2”] WISE_TAGS–> (or / <!–WISE_TAGS […] WISE_TAGS–> / inside a script block).
  • Use element Scoping Inside HtmlContent: Since multiple HtmlContent objects can exist on the same Page, use data-* attributes and element.querySelector(…) instead of fixed id attributes and document.getElementById.
  • Specify the Target Environment API Clearly: State upfront whether the AI should generate code for Page (HtmlContent) (tagChanged, TagRead, TagSet) or Screen (WebView2) (window.WiseSvg?.subscribeTag, window.WiseSvg?.getTag), and share the matching template.
  • Avoid External CDNs and Library Dependencies: Industrial SCADA systems typically operate on offline local networks. Request all CSS, SVG, JavaScript, and 3D/Canvas rendering code to run self-contained in a single block with no external files or CDN links.
  • Keep Data Type Conversions Safe: Depending on the runtime environment, numeric or boolean tags may arrive as strings (for example, “887” or “true”). Use Number(value) with range clamping (Math.max / Math.min) for calculations, and safe boolean checks such as value === true || String(value).toLowerCase() === “true”.
  • Take a Hybrid Design Approach: You do not have to code every element from scratch. Just like the top navigation bar in the sample project, you can handle page navigation or operator buttons with Wise SCADA’s native controls while combining them with HtmlContent or WebView2 for rich process graphics.
Sample AI Prompt

To generate your own custom screen or component, you can copy and paste the template below directly into your preferred AI assistant.

Note: Fill in the (…) sections according to your own design requirements, target environment, and the actual tag names in your project.

Plaintext
I want to design a custom screen for Wise SCADA. My target environment is: (... enter Page / HtmlContent or Screen / WebView2 ...).

Using the Wise SCADA tag communication method shown in the documentation above, create a (...) design for me.

The SCADA tags I will use in this project are:
- (... Tag name and type, e.g., TankLevel - REAL ...)
- (... Tag name and type, e.g., PumpRun - BOOL ...)

Please follow these rules strictly:
1. Declare all live-subscribed tags accurately inside the WISE_TAGS comment block.
2. For Page (HtmlContent), use tagChanged, TagRead, TagSet, and element.querySelector (with data-* attributes). For Screen (WebView2), use window.WiseSvg?.subscribeTag, window.WiseSvg?.getTag, and standard document selectors.
3. Do not use any external CDNs, libraries, or internet-dependent resources; provide all HTML, CSS, SVG, and JavaScript code in a single self-contained block.
4. Handle incoming tag values safely (use Number() with range clamping for numeric values, and safe true/false checks for boolean values).

Sample Project and Walkthrough Video

To explore the four-page Page layout, the WebView2 3D screen, and the 100 ms C# process simulation script featured in this guide, download the sample project and watch the walkthrough video:

Sample Wise SCADA Project: Sample Project (.zip)
YouTube Overview Video: https://www.youtube.com/watch?v=hdVmfKio-Bw

Similar Posts

Leave a Reply