JavaScript
const pushId = () => Math.random();
const newTimestamp = (days) => moment().add(days, 'd').toDate().getTime();
const {start, end, dataSets} = {
start: newTimestamp(-6),
end: newTimestamp(0),
dataSets: {
'set1': {
type: 'container',
state: 'mixed',
title: 'Self Assessment',
children: {
child1: {
type: 'line',
state: 'enabled',
title: 'Mood',
color: '#ff0000',
yAxis: {
min: 0,
max: 9,
},
data: [{
timestamp: newTimestamp(-6),
value: 3,
}, {
timestamp: newTimestamp(-5),
value: 3,
}, {
timestamp: newTimestamp(-4),
value: 6,
}, {
timestamp: newTimestamp(-3),
value: 8,
}, {
timestamp: newTimestamp(-2),
value: 7,
}, {
timestamp: newTimestamp(-1),
value: 4,
}, {
timestamp: newTimestamp(0),
value: 3,
}],
},
child2: {
type: 'line',
state: 'disabled',
title: 'Pain',
color: '#00ff00',
yAxis: {
min: 0,
max: 9,
},
data: [{
timestamp: newTimestamp(-6) - 10000,
value: 9 - 3,
}, {
timestamp: newTimestamp(-5) - 10000,
value: 9 - 3,
}, {
timestamp: newTimestamp(-4) - 10000,
value: 9 - 6,
}, {
timestamp: newTimestamp(-3) - 10000,
value: 9 - 8,
}, {
timestamp: newTimestamp(-2) - 10000,
value: 9 - 7,
}, {
timestamp: newTimestamp(-1) - 10000,
value: 9 - 4,
}, {
timestamp: newTimestamp(0) - 10000,
value: 9 - 3,
}],
},
},
},
},
}
const chartOptions = (start,...