I cannot display more than 1000 points in my charts | ThingSpeak Plugins | 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
I cannot display more than 1000 points in my charts
Avatar
kikorojo
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
1
March 15, 2017 - 11:49 am
sp_Permalink sp_Print

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!

Avatar
afan
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
2
March 18, 2017 - 6:30 pm
sp_Permalink sp_Print

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:
13 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 250

Vinod: 154

cstapels: 83

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

webone

KMVp

aamir786

sugengprayogi

vickysam@gmail.com

farmerkjs

Forum Stats:

Groups: 4

Forums: 17

Topics: 1289

Posts: 4481

 

Member Stats:

Guest Posters: 1

Members: 5652

Moderators: 0

Admins: 2

Administrators: Hans, lee