ThingSpeak

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create a Chart

To create a chart, go to the following URL, replacing CHANNEL_ID and FIELD_ID with values from one of your Channels.

http://api.thingspeak.com/channels/CHANNEL_ID/charts/FIELD_ID

Chart Parameters

  • title (string) Chart title, default: channel name (optional)

  • xaxis (string) Chart's x-axis label, default: "Date" (optional)

  • yaxis (string) Chart's y-axis label, default: field name (optional)

  • color (string) Line color, default: red (optional)

  • bgcolor (string) Background color, default: white (optional)

  • type (line/bar/column/spline) Type of chart, default: line (optional)

  • width (integer) Chart width in pixels, iframe width will be 20px larger, default chart width: 400. Set to auto to automatically adjust chart size based on its parent container. (optional)

  • height (integer) Chart height in pixels, iframe height will be 20px larger, default chart height: 200. Set to auto to automatically adjust chart size based on its parent container. (optional)

  • dynamic (true/false) Make chart update automatically based on the time interval mentioned in update, default: false (optional)

  • step (true/false) Draw chart as a step chart, default: false (optional)

  • export (true/false) Show export buttons, so that chart can be saved as an image, default: false (optional)

  • yaxismin (decimal) Minimum value of chart's Y-Axis; if blank the value is auto-calculated (optional)

  • yaxismax (decimal) Maximum value of chart's Y-Axis; if blank the value is auto-calculated (optional)

  • update (integer) Time interval in seconds to update the chart automatically, default: 15 (optional)

Feed Parameters

  • api_key (string) Read API key for this specific channel (optional--no key required for public channels)

  • results (integer) Number of entries to retrieve, 8000 max, default of 100 (optional)

  • days (integer) Number of 24-hour periods before now to include in feed (optional)

  • start (datetime) Start date in format YYYY-MM-DD%20HH:NN:SS (optional)

  • end (datetime) End date in format YYYY-MM-DD%20HH:NN:SS (optional)

  • offset (integer) Timezone offset that results should be displayed in. Use the timezone parameter for greater accuracy. (optional)

  • status (true/false) Include status updates in feed by setting "status=true" (optional)

  • location (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)

  • min (decimal) Minimum value to include in response (optional)

  • max (decimal) Maximum value to include in response (optional)

  • round (integer) Round to this many decimal places (optional)

  • timescale (integer or string) Get first value in this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)

  • sum (integer or string) Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)

  • average (integer or string) Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)

  • median (integer or string) Get median of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)

    Note:   You cannot use results parameter in combination with timescale, sum, average, or median.

Create a Chart with Chart and Feed Parameters

You can set the chart and feed parameters to control the chart title, axes labels, chart color and type, and chart width and height. You can also display the average values, adjust the y-axis maximum value, and dynamically update the chart. Also, you can add more parameters as mentioned in Chart Parameters and Feed Parameters to alter the chart.

For example, you can create a column chart using the title, xaxis, yaxis, color, type, width, height, average, yaxismax, and dynamic parameters:

http://api.thingspeak.com/channels/9/charts/2?title=Outside Ambient Temperature&xaxis=Time&yaxis=Average Temperature [F]&color=blue&type=column&width=500&height=500&average=10&yaxismax=100&dynamic=true
The chart displays the average outside temperature values over a 10 — minute window using the temperature data from field 2 of channel 9 on ThingSpeak.

More About

Was this topic helpful?