Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello,
I am developing Thingworx web application that reads different sensor data being published over an MQTT protocol. I subscribe to a topic and getting the values displayed on a Gauge widget.
Now, I want it to form a chart based on the sensor data being received. I watched the "how to create and configure chart widget" video given in the developer community where they are getting an option of GetStreamEnterieswithData in the Add data section. I am not getting that option. I don't know where I am going wrong.
I am getting the data in the Gauge but I also want it on the chart. Please help me with proper steps on how to configure chart widget with MQTT??
Thank you!
You need to either
1. use the MQTT topic updated to parse out data and write that to a Stream
2. use the MQTT topic updated to parse out data and write that to actual properties and log those
then you can use the Stream or ValueStream to populate your chart with historical data.
I did exactly what you told in the second comment. Data from MQTT server being parsed in the properties and logging it. Then using value stream to populate the chart. I am getting data on the label but not on the chart. If I set the value manually from the properties, it gets plot on the chart but not from the data received over MQTT. I am getting the same data on the label without any issues.
Here are the screenshots of my project. Please let me know where I am going wrong. Thank you
Did you set the X and Y axis for the Chart?
hard to tell for sure, but as far as I can tell everything looks to be done correctly.
In the Time Series Widget properties section left-hand side below, I am getting an option of a timestamp in XAxis field and property name in the Data Field1. Please see the screenshots for better understanding. Thank you!
All of it looks correct, you are saying this isn't displaying the series??
It displays on the label but not on the chart until values entered manually from the properties as shown in the screenshots below.
From what you are saying, the logging is not working?
So the MQTT sub is receiving updates and you are processing those and writing those to the property, but for some reason they aren't being logged?
yes, it seems so. Getting single values on label and gauge but not on chart even though checked persistent and logged in the property. I don't know where I am going wrong.
Persistence is not required btw, but shouldn't impact the logging either.
For now set the DataChange to Always vs Value and see if that makes a difference.
No sir. I tried with Data change to always and values with change threshold 0 but it does not work yet.
Please look at the binding once as I doubt those. Do I need to do of All data change service shown right-hand side at the bottom?
The AllDataChanged event is just the ability to chain another service after this service.
It actually means that the DataShape of the delivered data is different from the previous time the service was called.
it so far has been a fairly rare use case.
All right sir. What I need to do to get data on chart? I must be missing something though everything looks correct. Isn't it?
Hello, did you find final solution how to correctly store data into valuestream for next chart creation? I have same problem manualy are stored data in valuestream but data from mqtt broker does not store, they only set property value and you can view it. What may cause this behaviour? Many thanks for any response...