Skip to content

Commit 8a69606

Browse files
PBrunotclaude
andcommitted
Fix Chart.js real-time chart functionality and bump version to 0.1.4
- Removed incorrect integrity hash from Chart.js CDN link that was blocking load - Updated Chart.js time adapter to version 3.0.0 for better compatibility - Fixed chart configuration to use proper x,y data format for Chart.js 4.x - Added time scale unit configuration and axis titles - Updated data structure to work with Chart.js time scale properly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent b66625d commit 8a69606

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

multimeter.html

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
1010
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
11-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.js"
12-
integrity="sha384-+6dh2CHKuNJGU8U8VwpCGO85vKlV6/wCfFb5BKFR9X6P5P6qf/QVBIVpyV8t7B6p" crossorigin="anonymous"></script>
13-
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"
14-
type="module"></script>
11+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.js"></script>
12+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
1513
</head>
1614

1715
<body>
@@ -176,12 +174,14 @@ <h2>Real-time Chart</h2>
176174

177175
try {
178176
const data = {
179-
labels: chartData.map(item => item.Timestamp),
180177
datasets: [{
181178
label: chartData[0]?.Function || 'Measurement',
182179
backgroundColor: 'rgba(54, 162, 235, 0.2)',
183180
borderColor: 'rgb(54, 162, 235)',
184-
data: chartData.map(item => item.Value),
181+
data: chartData.map(item => ({
182+
x: item.Timestamp,
183+
y: item.Value
184+
})),
185185
fill: false,
186186
tension: 0.1
187187
}]
@@ -197,13 +197,22 @@ <h2>Real-time Chart</h2>
197197
x: {
198198
type: 'time',
199199
time: {
200+
unit: 'second',
200201
displayFormats: {
201202
second: 'HH:mm:ss'
202203
}
204+
},
205+
title: {
206+
display: true,
207+
text: 'Time'
203208
}
204209
},
205210
y: {
206-
beginAtZero: false
211+
beginAtZero: false,
212+
title: {
213+
display: true,
214+
text: 'Value'
215+
}
207216
}
208217
},
209218
plugins: {
@@ -221,7 +230,6 @@ <h2>Real-time Chart</h2>
221230
}
222231
} else {
223232
myChart.data = data;
224-
myChart.options = config.options;
225233
myChart.update('none');
226234
}
227235
} catch (error) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "owonb41t",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "A web-bluetooth interface for the OWON B41T+ multimeter",
55
"main": "owon.js",
66
"scripts": {

0 commit comments

Comments
 (0)