ThingSpeak Live Chart, multi channel, second axis, historical data, csv export

easydoor: Can someone tell me how can I manually chose the colour for new graphs? Thx

I am wondering the same thing. Anyone know where the line colors are set?

Aprox 3-4 months this script do not update automaticly, just if I reload a browser. I tried Chrome, Firefox..but same. In developer option of browser I see that it really updateing every 15second but I got error code:

Request URL:;key=xxxxxxxxxxxxxxxxx&_=xxxxxxxxxxxxxxx Request method:GET Remote address: Status code: 301 Version:HTTP/1.1

So error code 301 Moved Permanently. I read on google that it means that some links are not accessable any more. Can someone fix this? Thx

If I am not wrong it mean that original code used http instead of https that now is mandatory.

zoomx: If I am not wrong it mean that original code used http instead of https that now is mandatory.

Thx for replay.. All thingspeak links in codes are with https. Do u have any other suggestion?

Sorry, I wrote a complete useless response!

I tested both the original page and the modified one by Mr_ToR. You are right, it didn't update but I get this error net::ERR_ABORTED 422 (Unprocessable Entity)

GET;key=XXXXXXXXXXXXXXXX&_=1560321345892 net::ERR_ABORTED 422 (Unprocessable Entity)

Unfortunately I am not able to spot the error that should be in this line

 $.getJSON(''+channelKeys[channelIndex].channelNumber+'/feed/last.json?callback=?&offset=0&location=false;key='+channelKeys[channelIndex].key, function(data)

after last.json since till json I get the last data. My suspect is on the callback.

True..I realised the same. But is tehre anyone who can give us advise or change those few lines of code to work again? Btw I getting two error messages: Status code: 422 Unprocessable Entity and Status code: 301 Moved Permanently

Btw…I asked the same question on thingspeak thread and I got explanation that “Callback Parameter Deprecated” is from now deprecated. Look at link:

The post number 9.
He even mentioned link for cahnges at:

Ok, it seams to be that I have enough knowledge to fix. :) I realised with help of: with R2019a and their explanation:

Callback Parameter Deprecated

    JSONP is no longer supported by the ThingSpeak API.

    If your code uses the callback parameter in a request to, remove callback=? from the URL.

    For private channels, provide the read API key as part of the URL (for example ?api_key=READ_API_KEY). Public channels do not require an API key.

    For more information, see

that u need to modify next lines in this script from top of page: line: 93,149 and 378 and to remove


from line as to replace




. Example: Before (line 93):

$.getJSON(''+channelNumber+'/feed.json?callback=?&offset=0&results=2500;key='+key, function(data)

After (line 93):

$.getJSON(''+channelNumber+'/feed.json?&offset=0&results=2500;key='+key, function(data)

Repeat for all of three line. I realised that second line giving the error 301 and first 422

Well done!
So callback is related to error 422 and www to error 301!

I made the same changes and don’t get errors any more.


PS. Take care that the read API is in clear text on the source HTML page.

Hello everyone,

Has anyone managed to use the code as a Plugin that is displayed in Channel view?

For me there is no data loaded when I am using it as a Plugin in Channel view on I can only get data to load as a standard .html file loaded in a browser.

Hello, is anybody able to have two charts for the same channel on the same page? I managed to have two charts but only one is going to be displayed the other is blank.

if some one has an example to share !


First I must thank you for providing a fix for the “getJSON request failed!” error.

Sadly, today it has returned - I wonder what might have changed at Thingspeak to once again break this fantastic graphing tool.

I have the same problem.
function getJSON yelling error in a web browser: getJSON request failed!
Is there any fix for this?

Hello erveryone,
there currently seems to be a CORS Missing Allow Origin Error.
There are more details from MathWorks here:

Sadly this does not help. I tried to put the line: Header set Access-Control-Allow-Origin *
in apache.conf and activate in ssh mod_headers with the command: a2enmod headers and restarted the apache2, but the error is still here.
Or I misunderstand?

The issue is fixed now.
I am using this updated HighCharts html code: