cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Creating chart in Thingworx

jdave1
4-Participant

Creating chart in Thingworx

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!

13 REPLIES 13
PaiChung
22-Sapphire I
(To:jdave1)

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.

jdave1
4-Participant
(To:PaiChung)

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

Screenshot (325).pngScreenshot (330).pngScreenshot (327).pngScreenshot (331).pngScreenshot (328).pngScreenshot (329).png

PaiChung
22-Sapphire I
(To:jdave1)

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.

jdave1
4-Participant
(To:PaiChung)

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!Screenshot (332).pngScreenshot (333).png

PaiChung
22-Sapphire I
(To:jdave1)

All of it looks correct, you are saying this isn't displaying the series??

jdave1
4-Participant
(To:PaiChung)

It displays on the label but not on the chart until values entered manually from the properties as shown in the screenshots below.

Screenshot (335).png

PaiChung
22-Sapphire I
(To:jdave1)

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?

jdave1
4-Participant
(To:PaiChung)

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.

PaiChung
22-Sapphire I
(To:jdave1)

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.

jdave1
4-Participant
(To:PaiChung)

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? Screenshot (336).png

PaiChung
22-Sapphire I
(To:jdave1)

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?

kturon
10-Marble
(To:jdave1)

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...

Announcements


Top Tags