Auto update ThingSpeakPlot charts | ThingSpeak Apps | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
Auto update ThingSpeakPlot charts
Avatar
eggfile
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
1
November 22, 2016 - 10:20 am
sp_Permalink sp_Print

Hi, I use two Arduinos to count certain events. Each Arduino is sending its counter every 20sec to its Channel, i.e. I have two channels- one for each Arduino. In addition I have generated one ThingSpeakPlot visualisation which is calculating the difference between counter 1 from channel 1 and counter 2 from channel 2. The result is depicted using 

[Counter1Data, time] = thingSpeakRead(readChannelID1, 'Fields', Counter1FieldID, 'NumPoints', 30,'ReadKey', readAPIKey1);
[Counter2Data, time] = thingSpeakRead(readChannelID2, 'Fields', Counter1FieldID, 'NumPoints', 30,'ReadKey', readAPIKey2);

Difference = Counter1Data - Counter2Data;

thingSpeakPlot(time, [Difference]);

Problem: when the chart is generated/depicted in either Channel 1 or 2 it does not automatically update itself, i.e. when the counter values change the plot/chart does not update...it only does, when I manually refresh the page or open it the first time.

I'd like to have a "living" chart as I have it when visualizing each channel counter value separately.

Any help is appreciated- Thanks!

Avatar
Vinod

Forum Posts: 186
sp_UserOfflineSmall Offline
2
November 23, 2016 - 7:21 pm
sp_Permalink sp_Print

To confirm your request, you would like the plot generated using thingSpeakPlot to auto refresh every 'n' seconds? 

This is not possible today, but we will put it in the list of features to add based on user requirements. 

In the mean time, you could save the following into a simple HTML page. It auto reloads the page every 5 minutes. Instead of opening ThingSpeak.com, you would open this page.

<html lang="en">
 <body style="margin:0;padding:0">
   <iframe src="" id="myIFrame" style="border:none;" height="0" width="0"></iframe>
 </body>
 <script>
   var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
   var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
   var frameHdl = document.getElementById('myIFrame');
   frameHdl.src = "https://thingspeak.com/channels/YOURCHANNELNUMBER"
   frameHdl.height = height;
   frameHdl.width = width;
   window.setInterval("reloadPage();", 5*60*1000); //minutes to milliseconds 
   function reloadPage() {
     location.reload(true); 
   }
 </script> 
</html>
Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

epicpaymentsny

DanielBobby

mercedeszw18

ujuxoketate

olihfez

winnieeq69

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee