need help timeline chart... | ThingSpeak Projects | 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
need help timeline chart...
No permission to create posts
May 25, 2018
8:12 am
Avatar
memoryex
New Member
Members
Forum Posts: 1
Member Since:
May 25, 2018
sp_UserOfflineSmall Offline

hello I want to help connect the timeline chart with thingspeak JSON. An example: when the value is 1234567 IN, then the timeline is a bream line. when the 1234567 OUT stops the cut line and calculates how long the line is. I'll give you a code and a link to JSON:

https://api.thingspeak.com/channels/463450/feeds.json?api_key=VAL3TD2W5LADX7K1&results=5

SCRIPT:

https://www.gstatic.com/charts/loader.js

google.charts.load("current", {packages:["timeline"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {

var container = document.getElementById('example5.1');
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Room' });
dataTable.addColumn({ type: 'string', id: 'Name' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'Darbuotojas1', 'Viduje', new Date(0,0,0,12,0,0), new Date(0,0,0,13,30,0) ],
[ 'Darbuotojas2', 'Isoreje', new Date(0,0,0,14,0,0), new Date(0,0,0,15,30,0) ],
[ 'Darbuotojas3', 'Viduje', new Date(0,0,0,16,0,0), new Date(0,0,0,17,30,0) ],
[ 'Darbuotojas4', 'Isoreje', new Date(0,0,0,12,30,0), new Date(0,0,0,14,0,0) ],
[ 'Darbuotojas5', 'Viduje', new Date(0,0,0,14,30,0), new Date(0,0,0,16,0,0) ],
[ 'Darbuotojas+', 'Viduje', new Date(0,0,0,16,30,0), new Date(0,0,0,18,0,0) ]]);

var options = {
timeline: { colorByRowLabel: true }
};

chart.draw(dataTable, options);
}

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

anis, 43994554AKS, suda, marisol, qkpham, SANGAMNATH B

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457