B4J Question How to updating chart via B4J?

rbghongade

Active Member
Licensed User
Longtime User
Dear friends,
I am trying to create an application using B4J and Raspberry Pi 2 (a non-ui app). Raspberry Pi hosts the webpage (html). I want to update a line graph at timed intervals, but have no clue as to how to pass the value from B4J to html using jQuery. I am using RGraph as template for drawing line graph.
I am a complete novice as far as html and jQuery are concerned.
I was able to switch on/off an LED with a button on html page (client side) and also display a random value as text on the webpage.
Please let me know.
Regards,
 

rbghongade

Active Member
Licensed User
Longtime User
Dear billzhan,
Thank you for the reply. I tried the websocket method but am not able to get anywhere. How do I pass the parameters? I do not now how to write java script . Ihave attached my test project. If you can spare some time please let me know as to where I am going wrong.
 

Attachments

  • test.zip
    65.6 KB · Views: 193
Upvote 0

rbghongade

Active Member
Licensed User
Longtime User
Dear billzhan,
With your help I am now able to add one more object to html page ! Thanks once again. My new problem is that the data acquisition( here emulated by a timer) is triggered ONLY when websocket is connected, whereas I want it to continue irrespective of any client connection. However it should display the same whenever client is connected. Is there a way to achieve the same? I have attached my project for your perusal.
Thanks in advance!
 

Attachments

  • WEBSERVER.zip
    76.7 KB · Views: 191
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
Data is stored and retrieved in the main thread.
New client javascript is used to update the data for line graph.

Find the details in attached demo
 

Attachments

  • WEB_SERVER v2.zip
    115.2 KB · Views: 196
Upvote 0
Top