waveform-analysis 0.1.63 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +986 -964
- package/dist/style.css +1 -1
- package/dist/types/components/core/constants.d.ts +1 -1
- package/dist/types/components/core/trackLayoutBuilder.d.ts +1 -0
- package/dist/types/components/core/yAxisConstants.d.ts +1 -1
- package/dist/types/types/chart.d.ts +6 -1
- package/package.json +1 -1
- package/src/App.vue +2 -2
- package/src/components/WaveformChart.css +4 -0
- package/src/components/WaveformChart.vue +2 -2
- package/src/components/core/constants.ts +3 -3
- package/src/components/core/layout.ts +1 -1
- package/src/components/core/trackLayoutBuilder.ts +42 -1
- package/src/components/core/useWaveformLayout.ts +2 -1
- package/src/components/core/useWaveformPresentation.ts +1 -1
- package/src/components/core/xDomain.ts +26 -2
- package/src/components/core/yAxisConstants.ts +1 -1
- package/src/components/rendering/WaveformLegend.vue +1 -1
- package/src/components/rendering/WaveformSeriesLayer.vue +1 -1
- package/src/components/rendering/WaveformTrack.css +5 -2
- package/src/components/rendering/WaveformTrack.vue +7 -1
- package/src/components/rendering/WaveformTrackAxes.vue +8 -2
- package/src/demo/DemoChartHost.vue +1 -0
- package/src/types/chart.ts +6 -1
- package/src/App.test.ts +0 -400
- package/src/components/annotation/components.test.ts +0 -372
- package/src/components/annotation/markup.test.ts +0 -371
- package/src/components/annotation/serialization.test.ts +0 -114
- package/src/components/core/constants.test.ts +0 -29
- package/src/components/core/fixedYDomainLayout.test.ts +0 -204
- package/src/components/core/grid.test.ts +0 -197
- package/src/components/core/latestTaskScheduler.test.ts +0 -51
- package/src/components/core/layout.test.ts +0 -373
- package/src/components/core/title.test.ts +0 -76
- package/src/components/core/useWaveformData.test.ts +0 -95
- package/src/components/core/useWaveformRenderSampling.test.ts +0 -17
- package/src/components/core/xDomain.test.ts +0 -28
- package/src/components/core/yAxisNice.test.ts +0 -174
- package/src/components/core/yAxisSlotLayout.test.ts +0 -165
- package/src/components/core/yDomain.test.ts +0 -56
- package/src/components/interaction/WaveformTooltip.test.ts +0 -276
- package/src/components/interaction/viewportInteractionState.test.ts +0 -101
- package/src/components/utils/useAnimationFrameThrottle.test.ts +0 -53
- package/src/components/waveformChartCases/annotationEditingAndReprojection.test.ts +0 -257
- package/src/components/waveformChartCases/compactAndSharedHover.test.ts +0 -358
- package/src/components/waveformChartCases/dataAndHoverPerformance.test.ts +0 -358
- package/src/components/waveformChartCases/dataLifecycle.test.ts +0 -310
- package/src/components/waveformChartCases/frameGridAndFormatting.test.ts +0 -389
- package/src/components/waveformChartCases/gridFill.test.ts +0 -95
- package/src/components/waveformChartCases/incompleteDataHover.test.ts +0 -155
- package/src/components/waveformChartCases/interactionAndAnnotationCreation.test.ts +0 -328
- package/src/components/waveformChartCases/layoutAndDomains.test.ts +0 -371
- package/src/components/waveformChartCases/legendVisibility.test.ts +0 -350
- package/src/components/waveformChartCases/multiAxisAndPagination.test.ts +0 -400
- package/src/components/waveformChartCases/multiAxisLabelAlignment.test.ts +0 -61
- package/src/components/waveformChartCases/presentationAndAxes.test.ts +0 -345
- package/src/components/waveformChartCases/presentationMode.test.ts +0 -327
- package/src/components/waveformChartCases/renderingStyles.test.ts +0 -283
- package/src/components/waveformChartCases/sizingAndTitles.test.ts +0 -370
- package/src/components/waveformChartCases/trackOrder.test.ts +0 -323
- package/src/components/waveformChartCases/viewportBoxAndPan.test.ts +0 -365
- package/src/components/waveformChartCases/viewportConstraintsAndReset.test.ts +0 -311
- package/src/components/waveformChartCases/viewportLifecycle.test.ts +0 -132
- package/src/components/waveformChartCases/viewportReset.test.ts +0 -251
- package/src/components/waveformChartCases/wheelZoomOut.test.ts +0 -114
- package/src/components/waveformChartCases/workerSamplingIntegration.test.ts +0 -117
- package/src/components/waveformChartCases/xDomainStrategy.test.ts +0 -168
- package/src/components/waveformChartCases/yAxisLayout.test.ts +0 -103
- package/src/components/waveformChartCases/zoomIntentAndDataRebind.test.ts +0 -213
- package/src/components/waveformChartCases/zoomPointConstraints.test.ts +0 -308
- package/src/components/waveformLegendGeometry.test.ts +0 -21
- package/src/components/waveformNormalization.test.ts +0 -170
- package/src/core/data.test.ts +0 -241
- package/src/core/rendering.test.ts +0 -267
- package/src/core/renderingStrategies.test.ts +0 -90
- package/src/core/samplingReference.test.ts +0 -124
- package/src/core/wasmSampling.test.ts +0 -205
- package/src/core/workerSampling/multiresolution.test.ts +0 -69
- package/src/core/workerSampling/protocol.test.ts +0 -34
- package/src/core/workerSampling/repository.test.ts +0 -400
- package/src/core/workerSampling/repositoryCache.test.ts +0 -163
- package/src/core/workerSampling/repositorySampling.test.ts +0 -106
- package/src/core/workerSampling/repositoryTypedDataset.test.ts +0 -89
- package/src/core/workerSampling/repositoryWasmDataset.test.ts +0 -70
- package/src/data/simulatedWaveforms.test.ts +0 -60
- package/src/demo/plotMarginControls.test.ts +0 -29
- package/src/demo/xAxisLabelControls.test.ts +0 -86
- package/src/test/setup.ts +0 -82
- package/src/test/waveformChart.ts +0 -75
- package/src/utils/domain.test.ts +0 -28
- package/src/utils/formatters.test.ts +0 -131
- package/src/utils/sampling.test.ts +0 -226
- package/src/views/FixedYDomainDemo.test.ts +0 -44
- package/src/views/WasmSamplingDemo.test.ts +0 -13
- package/src/views/wasmSamplingDemoSampling.test.ts +0 -27
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ const data = ref<WaveformData>({
|
|
|
102
102
|
| `maxZoomScale` | `number \| null` | 未设置 | 最大缩放倍数;`null` 表示不限制 |
|
|
103
103
|
| `initialXDomain` | `[number, number]` | 未设置 | 所有图框的初始 X 范围(可超出数据,空白显示) |
|
|
104
104
|
| `initialXDomains` | `Record<string, [number, number]>` | 未设置 | 按 track/series ID 配置初始范围(可超出数据) |
|
|
105
|
-
| `xDomainStrategy` | `WaveformXDomainStrategy` | `{ type: '
|
|
105
|
+
| `xDomainStrategy` | `WaveformXDomainStrategy` | `{ type: 'integer-ms' }` | 自动 X 轴视口范围策略 |
|
|
106
106
|
| `yDomain` | `[number, number]` | 未设置 | 所有波形的固定 Y 轴范围 |
|
|
107
107
|
| `yDomains` | `Record<string, [number, number]>` | 未设置 | 按 track/series ID 配置固定范围 |
|
|
108
108
|
| `grid` | `WaveformGridOptions` | `{ rowCount: 2, columnCount: 1, showPagination: true, fillIncompleteLastRow: false }` | 网格和分页 |
|
|
@@ -113,7 +113,7 @@ const data = ref<WaveformData>({
|
|
|
113
113
|
| `legend` | `WaveformLegendOptions` | `{ position: 'top-right', orientation: 'auto' }` | 图例位置、排列、背景和交互 |
|
|
114
114
|
| `frameNumber` | `string \| number` | 未设置 | 图框水印内容 |
|
|
115
115
|
| `frameNumbers` | `Record<string, string \| number>` | 未设置 | 按 `trackId` 覆盖图框水印内容 |
|
|
116
|
-
| `zeroLine` | `WaveformZeroLineOptions` | `{ visible:
|
|
116
|
+
| `zeroLine` | `WaveformZeroLineOptions` | `{ visible: true }` | 零值参考线显隐与样式 |
|
|
117
117
|
| `cleanView` | `boolean` | `false` | 保留波形、图框和刻度的净图模式 |
|
|
118
118
|
| `presentationMode` | `boolean` | `false` | 禁用绘图区交互的展示模式 |
|
|
119
119
|
| `annotations` | `WaveformAnnotation[]` | `[]` | 受控标注数据 |
|
|
@@ -256,6 +256,9 @@ Y 轴会独立计算:
|
|
|
256
256
|
<WaveformChart :data="chartData" :axes="{ y: { splitNumber: 5 } }" />
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
+
最下方的刻度标签不做额外偏移,文字底部基线直接与 Y 轴最小值刻度线齐平。
|
|
260
|
+
原刻度数值、刻度线、网格和波形坐标保持不变;尺寸或坐标范围变化后,每根 Y 轴仍保持该对齐方式。
|
|
261
|
+
|
|
259
262
|
默认会将 Y 轴范围扩展为便于读取的等距刻度。传入 `nice: false` 可保持数据自动范围或
|
|
260
263
|
`yDomain` / `yDomains` 的原始端点:
|
|
261
264
|
|
|
@@ -319,7 +322,8 @@ chartRef.value?.setViewportDomain(trackDomain, trackIndex)
|
|
|
319
322
|
数据边界使旧 transform 失效;`resetViewport(trackIndex?)` 的既有行为保持不变。
|
|
320
323
|
|
|
321
324
|
没有显式配置初始范围时,可以通过 `xDomainStrategy` 将数据范围扩展为便于阅读的视口端点。
|
|
322
|
-
默认的 `{ type: '
|
|
325
|
+
默认的 `{ type: 'integer-ms' }` 将数据范围向外贴近合适的整十毫秒边界;`type: 'data'` 保持数据
|
|
326
|
+
最小值和最大值不变;`type: 'nice'` 使用固定刻度数量计算
|
|
323
327
|
易读边界,且只扩展视口,不修改原始点位、tooltip、标注或缩放事件值:
|
|
324
328
|
|
|
325
329
|
```vue
|
|
@@ -338,6 +342,12 @@ chartRef.value?.setViewportDomain(trackDomain, trackIndex)
|
|
|
338
342
|
按图框分别计算,共享 X 轴模式则合并所有可见图框后计算。所有范围仍使用原始秒坐标,
|
|
339
343
|
`timeUnit` 只影响显示。
|
|
340
344
|
|
|
345
|
+
若显式配置初始范围也需要贴近整十毫秒边界(例如 `-62881.52` 到 `14999.999`
|
|
346
|
+
显示为 `-63000` 到 `15000`),可设置 `xDomainStrategy` 为
|
|
347
|
+
`{ type: 'integer-ms', includeExplicit: true }`。该策略依据范围选择主刻度十分之一作为端点
|
|
348
|
+
取整步长,不采用可能将末端扩大至 `20000` 的主刻度;短范围保留毫秒精度。
|
|
349
|
+
显式初始范围仍须通过 `includeExplicit` 开启,原始数据坐标不变。
|
|
350
|
+
|
|
341
351
|
独立坐标模式下,回填响应应只替换 `seriesIds` 对应的系列,并调用
|
|
342
352
|
`resetViewport(trackIndex)`;其他图框的数据和缩放状态应保持不变。独立模式下双击图框触发的
|
|
343
353
|
`zoom-reset` payload 会包含该图框的 `trackIndex` 和 `seriesIds`;共享 X 范围模式的 payload
|
|
@@ -377,6 +387,8 @@ const chartData = {
|
|
|
377
387
|
`(V) 3`。单位为空、全为空白或未配置时,不显示 `(单位)`,例如仍显示为 `E+03 3` 或 `3`。
|
|
378
388
|
多 Y 轴模式下,每根轴使用该轴首个 series 的单位。
|
|
379
389
|
|
|
390
|
+
左侧通道名称使用 14px、字重 600 的加粗文字,按各道附近刻度文字自动计算间距,并使用同一列中相同轴位的最大间距,保证多道名称垂直对齐;左侧留白随刻度宽度调整,避免名称与刻度重叠。
|
|
391
|
+
|
|
380
392
|
### 线型、点型与误差棒
|
|
381
393
|
|
|
382
394
|
每条序列可以独立设置连线方式、数据点符号和误差棒:
|
|
@@ -551,7 +563,8 @@ const hiddenSeriesIds = ref<string[]>([])
|
|
|
551
563
|
|
|
552
564
|
### 零值参考线与净图
|
|
553
565
|
|
|
554
|
-
`zeroLine` 用于绘制 `y = 0`
|
|
566
|
+
`zeroLine` 用于绘制 `y = 0` 的水平参考线,默认显示红色(`#ff0000`)、1px 宽的虚线
|
|
567
|
+
(`dash: '6 4'`)。参考线只在对应 Y 轴的当前 domain
|
|
555
568
|
包含 0 时渲染,不会为了显示参考线而扩展数据范围。多值轴模式下,每根可见 Y 轴分别按自身
|
|
556
569
|
scale 定位零线:
|
|
557
570
|
|
|
@@ -560,7 +573,7 @@ scale 定位零线:
|
|
|
560
573
|
:data="chartData"
|
|
561
574
|
:zero-line="{
|
|
562
575
|
visible: true,
|
|
563
|
-
color: '#
|
|
576
|
+
color: '#ff0000',
|
|
564
577
|
width: 1,
|
|
565
578
|
dash: '6 4',
|
|
566
579
|
}"
|
|
@@ -570,6 +583,9 @@ scale 定位零线:
|
|
|
570
583
|
`dash` 直接对应 SVG 的 `stroke-dasharray`;传入空字符串可显示实线。无效或非正数的
|
|
571
584
|
`width` 会回退到 `1`。
|
|
572
585
|
|
|
586
|
+
只传入颜色或线型时仍默认显示,例如 `:zero-line="{ color: '#0960bd', dash: '' }"`
|
|
587
|
+
显示蓝色实线。使用 `:zero-line="{ visible: false }"` 可关闭零线。颜色和线型配置可动态修改。
|
|
588
|
+
|
|
573
589
|
设置 `cleanView` 后,组件保留波形、图框边框、X/Y 轴刻度及刻度值,并隐藏标题内容、图例、
|
|
574
590
|
网格、轴标签、图框背景、帧水印、零值参考线、标注和分页器。原图的标题区域、边距和波形
|
|
575
591
|
尺寸保持不变;缩放、悬浮、十字线和 tooltip 仍然可用,切换回普通模式后原有配置和标注
|