const actions = [
{
name: 'duration +1000',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.duration < 60000) {
realtimeOpts.duration += 1000;
chart.update('none');
}
}
},
{
name: 'duration -1000',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.duration > 1000) {
realtimeOpts.duration -= 1000;
chart.update('none');
}
}
},
{
name: 'ttl +1000',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.ttl < 60000) {
realtimeOpts.ttl += 1000;
chart.update('none');
}
}
},
{
name: 'ttl -1000',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.ttl > 1000) {
realtimeOpts.ttl -= 1000;
chart.update('none');
}
}
},
{
name: 'refresh +200',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.refresh < 5000) {
realtimeOpts.refresh += 200;
chart.update('none');
}
}
},
{
name: 'refresh -200',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.refresh > 200) {
realtimeOpts.refresh -= 200;
chart.update('none');
}
}
},
{
name: 'delay +200',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.delay < 5000) {
realtimeOpts.delay += 200;
chart.update('none');
}
}
},
{
name: 'delay -200',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
if (realtimeOpts.delay > 0) {
realtimeOpts.delay -= 200;
chart.update('none');
}
}
},
{
name: 'frameRate: 1',
handler(chart) {
chart.options.scales.x.realtime.frameRate = 1;
chart.update('none');
}
},
{
name: 'frameRate: 5',
handler(chart) {
chart.options.scales.x.realtime.frameRate = 5;
chart.update('none');
}
},
{
name: 'frameRate: 30',
handler(chart) {
chart.options.scales.x.realtime.frameRate = 30;
chart.update('none');
}
},
{
name: 'frameRate: 60',
handler(chart) {
chart.options.scales.x.realtime.frameRate = 60;
chart.update('none');
}
},
{
name: 'pause on/off',
handler(chart) {
const realtimeOpts = chart.options.scales.x.realtime;
realtimeOpts.pause = !realtimeOpts.pause;
chart.update('none');
}
}
];