This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Change the Trend URL
#1
Hi we have a energy page which uses widgets to show relevant energy data like Volts, Amps, PF, Etc.
We have various buttons Btn1, Btn2, Btn3 etc, which we have named which widget page to show, like M1-Energy, M2-Energy.
At present when the button is pressed, the correct widget is shown over the top of the Energy Trend Frame, and when the button is pressed again it then shows a Trend Frame for all Meters.
Question is, would it be possible rather than showing the default Trends page for all meters, we could only show the trend page for relevent meters.
Example if we press Btn2, Widget M2-Energy is shown, when Btn2 is pressed again then Trend Page M2-Energy is shown.

Any help or advise would be great.
Reply
#2
In Trends tab click "Direct link" button at the bottom of the page. There you can create links that show only certain trends.
Reply
#3
(17.07.2026, 11:33)admin Wrote: In Trends tab click "Direct link" button at the bottom of the page. There you can create links that show only certain trends.

Thanks seen that direct link, but not sure how can I get the URL to change depending on which button was pressed. We have around 20 Meters
like
M1 btn is pressed it should toggle between widget page M1-Energy and frame URL /scada-vis/trends?id=1&mode=week
M2 btn is pressed it should toggle between widget page M2-Energy and frame URL /scada-vis/trends?id=2&mode=week
Reply
#4
Try this, change widget IDs as needed:
Code:
const widgetId = 15 const frameWidgetId = 17 Visu.on('widget-ready', widgetId, ({ widget }) => {   const clickHandler = widget.component.compactModeClick   const frame = document.getElementById(`widget-frame-${frameWidgetId}`)   widget.component.compactModeClick = () => {     const shown = widget.component.showPopover     clickHandler()          if (shown) {       frame.src = '/scada-vis/trends?id=1&mode=week'     }   } })
Reply
#5
Hi admin, thanks for this but having a problems trying to impliment.
How do I find the widgetId & frameWidgetId Think I know we know the widgetID , but sure so chcking.

have placed the provide code like this in Custom JavaScript

$(function() {
const widgetId = 18
const frameWidgetId = ?????

Visu.on('widget-ready', widgetId, ({ widget }) => {
const clickHandler = widget.component.compactModeClick
const frame = document.getElementById(`widget-frame-${frameWidgetId}`)

widget.component.compactModeClick = () => {
const shown = widget.component.showPopover
clickHandler()

if (shown) {
frame.src = '/scada-vis/trends?id=1&mode=week'
}
}
})
});

not sure how to tie the button to the function, therefore not sure what to do for button 2, 3, 4, ..... 20 etc.

If you could provide a bit more info, I would appreciate the helping hand
Reply
#6
In Visu you can see the ID on any widget settings on the top.
------------------------------
Ctrl+F5
Reply
#7
how do I find the iframe ID ?
Reply
#8
It's the same as frame widget ID.
Reply


Forum Jump: