Hi there! I´m having problems to plot data on a web chart when I receive it from M2MQTT library (client_MqttMsgPublishReceived method) which run in a different thread. I have used the same library for a desktop application, and in these case using Dispatcher.
Invoke I have solved this problem. I am new programming web application so have been so difficult to solve this ploblem. When I debug the code the messages are being received OK, so the problem is when trying to plot it in the chart.
When I debug the code the messages are being received OK, so the problem is when trying to plot it in the chart.
We could use the code where you're trying to plot the chart. Also, please provide sample data which you want to plot in the chart which you said received OK when you debugged it.
I have a method which plot the data taking data from a string. When I use this method in the Page_Load method it works but when calling it from the received data method I obtain a NullObjectReference error refered to the Chart. The received data method run
in a different thread and I think this is the problem. For a desktop application this problem is easy to solve by using Dispatcher.Invoke but I don´t know how to develop something similar on a web application.
None
0 Points
5 Posts
Plot data in a Chart when receiving from method running in a different thread!
Nov 18, 2019 11:39 AM|ernesto_gf|LINK
Hi there! I´m having problems to plot data on a web chart when I receive it from M2MQTT library (client_MqttMsgPublishReceived method) which run in a different thread. I have used the same library for a desktop application, and in these case using Dispatcher. Invoke I have solved this problem. I am new programming web application so have been so difficult to solve this ploblem. When I debug the code the messages are being received OK, so the problem is when trying to plot it in the chart.
Thanks in advance for your help!
Contributor
3140 Points
983 Posts
Re: Plot data in a Chart when receiving from method running in a different thread!
Nov 19, 2019 03:08 AM|Yang Shen|LINK
Hi ernesto_gf,
We could use the code where you're trying to plot the chart. Also, please provide sample data which you want to plot in the chart which you said received OK when you debugged it.
Best Regard,
Yang Shen
None
0 Points
5 Posts
Re: Plot data in a Chart when receiving from method running in a different thread!
Nov 19, 2019 08:35 AM|ernesto_gf|LINK
Hi Yang Shen,
I have a method which plot the data taking data from a string. When I use this method in the Page_Load method it works but when calling it from the received data method I obtain a NullObjectReference error refered to the Chart. The received data method run in a different thread and I think this is the problem. For a desktop application this problem is easy to solve by using Dispatcher.Invoke but I don´t know how to develop something similar on a web application.
None
0 Points
5 Posts
Re: Plot data in a Chart when receiving from method running in a different thread!
Nov 19, 2019 09:09 AM|ernesto_gf|LINK
These is the received data method from which the chart is not accesible and give NullReferenceException