Bring Thingspeak data JSON into Highcharts Multiline Example

46 views Asked by At

I want to create a multiline chart with my own data from thingspeak cloud. The demo I have tried to modify is: https://jsfiddle.net/api/post/library/pure/

This part of the code:

     `const promises = names.map(name => new Promise(resolve => {
            (async () => {
                const data = await fetch(
                   ** 'https://cdn.jsdelivr.net/gh/highcharts/[email protected]/' +
                    'samples/data/' + name.toLowerCase() + '-c.json'**
                )
                    .then(response => response.json());
                resolve({ name, data });
            })();
        }));
`

must be modified to:

https://api.thingspeak.com/channels/**channel_id**/feed.json (with the right id copied to a browser status line it loads my data field 1 to field 8)

Else:

  • I am aware, that the names of my fields must then correspond to the field names in: const names = ['MSFT', 'AAPL', 'GOOG'];
  • I have to insert in the header:

So far I don't get it run.

Question 1: I have tried to search various examples and hints, but no success. How to provide the right working URL in that await fetch part? Most example show CSV, but I am having Thingspeak cloud. And usually this works by $get.JSON .. and such an URL: https://api.thingspeak.com/channels/**channel_id**/feed.json

Question 2: is it possible to show in the example fiddle two columns and one line? or is that not possible and it will be always same serie type?

Thank you very much for you hints, Manfred

0

There are 0 answers