The two 'receiver' has to show different data each other. I broadcast 2 identical messages with different payload. I added a property 'chart_id' in the message payload also on the Embedded View and check if the message have to be listened to.
Tried the three options scopes from message + handler script checkboxes: view, session, and page.
def broadcast_chart_payload(self,payload):
messageType = 'chart-payload-handler'
system.perspective.sendMessage(messageType, payload, scope = 'session')
return
The handler is on the component (xychart) which is in a Column View (screenshot below) with other components. That column view is embedded within a view used in a popup.

The Graph view is embedded 4 times (not only 2) within a MultiGraphView

On the view I put an action fired when startup (runAction):
from generic.multi_graph import MultiGraph
multiGraph = MultiGraph(self.view.rootContainer, self.view.params.graphlist)
multiGraph.displayGraph()
Full Class Here:
from generic import logger
class MultiGraph:
def __init__(self, p_view, p_graphInfolist):
self.mainview = p_view
self.graphInfolist = p_graphInfolist
self.embeddedviews = ['EmbeddedView1','EmbeddedView2','EmbeddedView3','EmbeddedView4']
self.graphPaths = {
'bool' : 'ViewComponent/DeviceInfo/VCDeviceHistoryGraphSerieCompact',
'float' : 'ViewComponent/DeviceInfo/VCDeviceHistoryStatusChartCompact'
}
self.hideGraphs()
return
def displayGraph(self):
logger.log('display')
i = 0
for graphInfo in self.graphInfolist:
i_view = self.mainview.getChild(self.embeddedviews[i])
i_view.props.path = self.graphPaths[graphInfo['data_type']]
payload = {
'chart_id' : (i + 1),
'start_date' : graphInfo['start_date'],
'end_date' : graphInfo['end_date'],
'tag_device' : graphInfo['tag_device'],
'tag_directory' : graphInfo['tag_directory'],
'tag_property' : graphInfo['tag_property'],
'date_format': self.mainview.session.custom.user_settings.date_format
}
logger.log(payload)
self.broadcast_chart_payload(payload)
i_view.meta.visible = True
i = i + 1
return
def hideGraphs(self):
for ev in self.embeddedviews:
i_view = self.mainview.getChild(ev)
i_view.meta.visible = False
return
def broadcast_chart_payload(self,payload):
logger.log('broadcast payload...')
messageType = 'chart-payload-handler'
system.perspective.sendMessage(messageType, payload, scope = 'session')
return
Additional info:
- The user will choose to show or hide 1 to 4 graph from a table-list of tags (View Graph Button = PopUpView MultiGraph).
- The embedded view path is changing on 'runtime' because I need to use 2 different chart views according the user preferences.
- logger.log() is a custom function to write into a database.
As you can see on logs, the message is never received
Thanks a lot for the quick replies.