I cannot display more than 1000 points in my charts | ThingSpeak Plugins | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
I cannot display more than 1000 points in my charts
No permission to create posts
March 15, 2017
11:49 am
Avatar
kikorojo
New Member
Members
Forum Posts: 1
Member Since:
February 28, 2017
sp_UserOfflineSmall Offline

Hello!

I have a plugin to display data using Highstock charts in my channels. In order to get the data to feed the plots I am using the command $.getJSON (similar to what the Multiple series example does). The problem is that the command $.getJSON is only able to request 1000 data points (I have tried to change its input for higher values in 'results=1000' but that does not work). Any idea on how can get more than 1000 points in my graphs?

This is the code that I am using:

$(function () {
  var my_offset = new Date().getTimezoneOffset();
 
    $.getJSON('https://api.thingspeak.com/channels/239388/fields/2.json?results=1000&api_key=', function (data) {
    var field_name = 'field' + 2;   
  // iterate through each feed
    var chart_data = [];  

    $.each(data.feeds, function() {
         var point = new Highcharts.Point();
         var value = this[field_name];
         point.x = Date.parse(this.created_at) - (my_offset * 60000);
         point.y=parseFloat(value);
         chart_data.push(point);        
      });

 

Thank you very much for your help!

March 18, 2017
6:30 pm
Avatar
afan
New Member
Members
Forum Posts: 3
Member Since:
May 13, 2016
sp_UserOfflineSmall Offline

Hi,

A good way to find out about the root cause of the problem here is to use a public channel and see whether $.getJSON is able to request more than 1000 data points.

I used the Channel ID 9 to find out whether $.getJSON works with more than 1000 data points. Below is the API request:

$.getJSON("https://api.thingspeak.com/channels/9/fields/1.json?offset=0&round=2&results=1100",
function(data){
console.log(data.feeds.length);
});

Output -> 1100

A most probable reason for you not getting more than 1000 data points could be insufficient number of data points in your channel.

Try to find out the exact number of data points in your channel, and see whether the results parameter has a number <= the number of data points.

Do let me know if this doesn't help. 

Regards,

Afan

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

harriettlf60, ShaToow, Aleftinfenny, DiaBentee, hugo11dom@gmail.com, Pisaruk530

Administrators: Hans: 387, lee: 457