|
126 | 126 | series: [ |
127 | 127 | {}, |
128 | 128 | { |
129 | | - label: "A", |
| 129 | + label: "step after", |
130 | 130 | stroke: "blue", |
| 131 | + fill: "rgba(0,0,255,0.3)", |
131 | 132 | width: 2, |
132 | 133 | paths: uPlot.paths.stepped({ |
133 | 134 | align: 1, |
134 | 135 | // ascDesc: true, |
135 | 136 | }), |
136 | 137 | }, |
| 138 | + { |
| 139 | + label: "linear", |
| 140 | + stroke: "red", |
| 141 | + width: 2, |
| 142 | + }, |
| 143 | + { |
| 144 | + label: "spline", |
| 145 | + stroke: "orange", |
| 146 | + width: 2, |
| 147 | + paths: uPlot.paths.spline(), |
| 148 | + }, |
137 | 149 | ], |
138 | 150 | }; |
139 | 151 |
|
140 | | - let vals9 = [null,null,null,1,1,1,1,1,null,null,2,2,null,1,null,1,1,1,1,2,2,2]; |
| 152 | + let vals9 = [null,null,null,1,1,1,1,1,null,null,2,2,null,1,undefined,undefined,null,1,1,1,1,2,2,2,undefined,undefined]; |
141 | 153 | // let vals9 = [2,null,1,null,1,1]; |
142 | 154 | // let vals9 = [2,null,1]; |
143 | 155 |
|
144 | 156 | const data9 = [ |
145 | 157 | vals9.map((v, i) => i), |
146 | 158 | vals9, |
| 159 | + vals9.map((v, i) => v == null ? v : v + 0.1), |
| 160 | + vals9.map((v, i) => v == null ? v : v + 0.2), |
147 | 161 | ]; |
148 | 162 |
|
149 | 163 | let u9 = new uPlot(opts9, data9, document.body); |
|
160 | 174 | series: [ |
161 | 175 | {}, |
162 | 176 | { |
163 | | - label: "A", |
| 177 | + label: "step before", |
164 | 178 | stroke: "red", |
| 179 | + fill: "rgba(255,0,0,0.3)", |
165 | 180 | width: 2, |
166 | 181 | paths: uPlot.paths.stepped({ |
167 | 182 | align: -1, |
168 | 183 | // ascDesc: true, |
169 | 184 | }), |
170 | 185 | }, |
| 186 | + { |
| 187 | + label: "linear", |
| 188 | + stroke: "blue", |
| 189 | + width: 2, |
| 190 | + }, |
| 191 | + { |
| 192 | + label: "spline", |
| 193 | + stroke: "orange", |
| 194 | + width: 2, |
| 195 | + paths: uPlot.paths.spline(), |
| 196 | + }, |
171 | 197 | ], |
172 | 198 | }; |
173 | 199 |
|
174 | 200 | let u9_2 = new uPlot(opts9_2, data9, document.body); |
175 | 201 | </script> |
176 | 202 |
|
| 203 | + <script> |
| 204 | + { |
| 205 | + const _ = null; |
| 206 | + |
| 207 | + const s_blue = [ |
| 208 | + [0,4,6], |
| 209 | + [1,0,1], |
| 210 | + ]; |
| 211 | + |
| 212 | + const s_red = [ |
| 213 | + [0,1,2,3,4,5,6,7,8,9], |
| 214 | + [_,_,3,4,5,_,3,2,1,0], |
| 215 | + ]; |
| 216 | + |
| 217 | + const l_green = [ |
| 218 | + [1,8], |
| 219 | + [4.90,1.55], |
| 220 | + ]; |
| 221 | + |
| 222 | + const l_yellow = [ |
| 223 | + [0,5,9], |
| 224 | + [1.11,_,4.44], |
| 225 | + ]; |
| 226 | + |
| 227 | + const l_sin = [ |
| 228 | + [0,1,3,4,5,7,8,9], |
| 229 | + [ |
| 230 | + Math.sin(00 * (Math.PI / 180)) * 5, |
| 231 | + Math.sin(10 * (Math.PI / 180)) * 5, |
| 232 | + Math.sin(30 * (Math.PI / 180)) * 5, |
| 233 | + _, |
| 234 | + Math.sin(50 * (Math.PI / 180)) * 5, |
| 235 | + Math.sin(70 * (Math.PI / 180)) * 5, |
| 236 | + Math.sin(80 * (Math.PI / 180)) * 5, |
| 237 | + Math.sin(90 * (Math.PI / 180)) * 5, |
| 238 | + ], |
| 239 | + ]; |
| 240 | + |
| 241 | + let data = uPlot.join([ |
| 242 | + s_blue, |
| 243 | + s_red, |
| 244 | + l_green, |
| 245 | + l_yellow, |
| 246 | + l_sin, |
| 247 | + ]); |
| 248 | + |
| 249 | + const opts = { |
| 250 | + title: "Gaps in stepped after", |
| 251 | + width: 800, |
| 252 | + height: 400, |
| 253 | + scales: { |
| 254 | + x: { |
| 255 | + time: false, |
| 256 | + } |
| 257 | + }, |
| 258 | + series: [ |
| 259 | + {}, |
| 260 | + { |
| 261 | + label: "on/off", |
| 262 | + stroke: "blue", |
| 263 | + fill: "rgba(0,0,255,0.3)", |
| 264 | + width: 2, |
| 265 | + paths: uPlot.paths.stepped({ align: 1 }), |
| 266 | + }, |
| 267 | + { |
| 268 | + label: "[0..5]", |
| 269 | + stroke: "red", |
| 270 | + fill: "rgba(255,0,0,0.3)", |
| 271 | + width: 2, |
| 272 | + paths: uPlot.paths.stepped({ align: 1 }), |
| 273 | + }, |
| 274 | + { |
| 275 | + label: "dataset03", |
| 276 | + stroke: "green", |
| 277 | + width: 2, |
| 278 | + }, |
| 279 | + { |
| 280 | + label: "dataset04", |
| 281 | + stroke: "yellow", |
| 282 | + width: 2, |
| 283 | + }, |
| 284 | + { |
| 285 | + label: "dataset05 sin", |
| 286 | + stroke: "black", |
| 287 | + width: 2, |
| 288 | + }, |
| 289 | + ], |
| 290 | + }; |
| 291 | + |
| 292 | + let u = new uPlot(opts, data, document.body); |
| 293 | + } |
| 294 | + </script> |
| 295 | + |
| 296 | + <script> |
| 297 | + { |
| 298 | + const _ = null; |
| 299 | + |
| 300 | + const s_blue = [ |
| 301 | + [0,4,6], |
| 302 | + [1,0,1], |
| 303 | + ]; |
| 304 | + |
| 305 | + const s_red = [ |
| 306 | + [0,1,2,3,4,5,6,7,8,9], |
| 307 | + [_,_,3,4,5,_,3,2,1,0], |
| 308 | + ]; |
| 309 | + |
| 310 | + const l_green = [ |
| 311 | + [1,8], |
| 312 | + [4.90,1.55], |
| 313 | + ]; |
| 314 | + |
| 315 | + const l_yellow = [ |
| 316 | + [0,5,9], |
| 317 | + [1.11,_,4.44], |
| 318 | + ]; |
| 319 | + |
| 320 | + const l_sin = [ |
| 321 | + [0,1,3,4,5,7,8,9], |
| 322 | + [ |
| 323 | + Math.sin(00 * (Math.PI / 180)) * 5, |
| 324 | + Math.sin(10 * (Math.PI / 180)) * 5, |
| 325 | + Math.sin(30 * (Math.PI / 180)) * 5, |
| 326 | + _, |
| 327 | + Math.sin(50 * (Math.PI / 180)) * 5, |
| 328 | + Math.sin(70 * (Math.PI / 180)) * 5, |
| 329 | + Math.sin(80 * (Math.PI / 180)) * 5, |
| 330 | + Math.sin(90 * (Math.PI / 180)) * 5, |
| 331 | + ], |
| 332 | + ]; |
| 333 | + |
| 334 | + let data = uPlot.join([ |
| 335 | + s_blue, |
| 336 | + s_red, |
| 337 | + l_green, |
| 338 | + l_yellow, |
| 339 | + l_sin, |
| 340 | + ]); |
| 341 | + |
| 342 | + const opts = { |
| 343 | + title: "Gaps in stepped before", |
| 344 | + width: 800, |
| 345 | + height: 400, |
| 346 | + scales: { |
| 347 | + x: { |
| 348 | + time: false, |
| 349 | + } |
| 350 | + }, |
| 351 | + series: [ |
| 352 | + {}, |
| 353 | + { |
| 354 | + label: "on/off", |
| 355 | + stroke: "blue", |
| 356 | + fill: "rgba(0,0,255,0.3)", |
| 357 | + width: 2, |
| 358 | + paths: uPlot.paths.stepped({ align: -1 }), |
| 359 | + }, |
| 360 | + { |
| 361 | + label: "[0..5]", |
| 362 | + stroke: "red", |
| 363 | + fill: "rgba(255,0,0,0.3)", |
| 364 | + width: 2, |
| 365 | + paths: uPlot.paths.stepped({ align: -1 }), |
| 366 | + }, |
| 367 | + { |
| 368 | + label: "dataset03", |
| 369 | + stroke: "green", |
| 370 | + width: 2, |
| 371 | + }, |
| 372 | + { |
| 373 | + label: "dataset04", |
| 374 | + stroke: "yellow", |
| 375 | + width: 2, |
| 376 | + }, |
| 377 | + { |
| 378 | + label: "dataset05 sin", |
| 379 | + stroke: "black", |
| 380 | + width: 2, |
| 381 | + }, |
| 382 | + ], |
| 383 | + }; |
| 384 | + |
| 385 | + let u = new uPlot(opts, data, document.body); |
| 386 | + } |
| 387 | + </script> |
| 388 | + |
177 | 389 | <script> |
178 | 390 | let tables10 = [ |
179 | 391 | [ |
|
0 commit comments