Charts GET /api/v1/device/logs with
Apache ECharts.
Keys are used only in this browser tab and are not stored.
State changes and event messages from the charted range (newest 200).
| Time | Sensor | Value | Message |
|---|
Fetching log data and rendering it with ECharts:
// Discover what can be charted (names drive the sensor picker):
const series = await fetch(
`${baseUrl}/api/v1/device/logs/series?resolution=10m`,
{ headers: { Authorization: `${providerKey}:${deviceKey}` } }
).then(r => r.json());
const end = Date.now();
const start = end - 6 * 60 * 60 * 1000; // 6 hours
const res = await fetch(
`${baseUrl}/api/v1/device/logs?start=${start}&end=${end}&resolution=10m`,
{ headers: { Authorization: `${providerKey}:${deviceKey}` } }
);
const data = await res.json();
const chart = echarts.init(document.getElementById('chart'));
chart.setOption({
xAxis: { type: 'time' },
yAxis: { type: 'value', scale: true },
tooltip: { trigger: 'axis' },
legend: {},
series: Object.entries(data.series).map(([name, s]) => ({
name,
type: 'line',
showSymbol: false,
data: s.points.map(([time, value]) => [time, value]),
})),
});
For other libraries the point format differs: Chart.js takes
points.map(([x, y]) => ({ x, y })) on a time scale, and
Plotly takes separate x and y arrays. Each
series carries a type field (Tmp,
pH, …) identifying the unit; this page charts one unit
type at a time so all series share a y-axis. Values arrive in fixed
canonical units (Tmp °C, ORP mV,
Sal PSU, Flo LPH - full table in the API
reference) regardless of the controller's display setting; convert
client-side if you need °F or other units.