waveform-analysis 0.1.71 → 0.1.73

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.
Files changed (122) hide show
  1. package/README.md +260 -40
  2. package/dist/assets/{workerRuntime-o5An0M-W.js → workerRuntime-5p-EI-GL.js} +1 -1
  3. package/dist/index.cjs +2 -1
  4. package/dist/index.js +3874 -2778
  5. package/dist/style.css +1 -1
  6. package/dist/types/components/WaveformChart.vue.d.ts +24 -6
  7. package/dist/types/components/annotation/WaveformAnnotationLayer.vue.d.ts +2 -0
  8. package/dist/types/components/annotation/useWaveformChartAnnotations.d.ts +0 -1
  9. package/dist/types/components/controls/WaveformToolbar.vue.d.ts +7 -0
  10. package/dist/types/components/controls/chartExportOptions.d.ts +5 -0
  11. package/dist/types/components/controls/chartSnapshot.d.ts +2 -0
  12. package/dist/types/components/controls/snapshotTitle.d.ts +2 -0
  13. package/dist/types/components/controls/toolbarRegistry.d.ts +21 -0
  14. package/dist/types/components/controls/useChartCommands.d.ts +42 -0
  15. package/dist/types/components/controls/useChartImageExport.d.ts +17 -0
  16. package/dist/types/components/controls/useControlMode.d.ts +8 -0
  17. package/dist/types/components/core/latestTaskScheduler.d.ts +1 -1
  18. package/dist/types/components/core/layout.d.ts +6 -3
  19. package/dist/types/components/core/niceScale.d.ts +34 -0
  20. package/dist/types/components/core/trackLayoutBuilder.d.ts +4 -1
  21. package/dist/types/components/core/trackPagination.d.ts +1 -1
  22. package/dist/types/components/core/types.d.ts +5 -0
  23. package/dist/types/components/core/useWaveformChartController.d.ts +24 -6
  24. package/dist/types/components/core/useWaveformChartLifecycle.d.ts +2 -2
  25. package/dist/types/components/core/useWaveformData.d.ts +2 -0
  26. package/dist/types/components/core/useWaveformLayout.d.ts +4 -1
  27. package/dist/types/components/core/useWaveformMeasurements.d.ts +2 -0
  28. package/dist/types/components/core/useWaveformRenderSampling.d.ts +1 -0
  29. package/dist/types/components/core/useWaveformViewportRestore.d.ts +5 -0
  30. package/dist/types/components/core/waveformChartTypes.d.ts +5 -0
  31. package/dist/types/components/core/waveformSamplingSession.d.ts +24 -0
  32. package/dist/types/components/core/yAxisLabelStyle.d.ts +3 -0
  33. package/dist/types/components/core/yAxisLayoutMetrics.d.ts +2 -1
  34. package/dist/types/components/core/yAxisPadding.d.ts +7 -0
  35. package/dist/types/components/core/yAxisTitleLayout.d.ts +2 -0
  36. package/dist/types/components/interaction/useExtremaTickViewport.d.ts +5 -0
  37. package/dist/types/components/interaction/useWaveformViewport.d.ts +1 -0
  38. package/dist/types/components/rendering/WaveformLegend.vue.d.ts +2 -2
  39. package/dist/types/components/rendering/WaveformTrack.vue.d.ts +2 -3
  40. package/dist/types/components/rendering/WaveformTrackAxes.vue.d.ts +1 -1
  41. package/dist/types/components/rendering/WaveformTrackBackdrop.vue.d.ts +1 -0
  42. package/dist/types/components/rendering/compactFrame.d.ts +5 -0
  43. package/dist/types/components/rendering/yAxisTickVisibility.d.ts +11 -0
  44. package/dist/types/core/lineBoundary.d.ts +4 -0
  45. package/dist/types/core/rendering.d.ts +4 -0
  46. package/dist/types/core/renderingStrategies.d.ts +2 -0
  47. package/dist/types/core/workerSampling/outputBoundaries.d.ts +4 -0
  48. package/dist/types/data/simulatedWaveforms.d.ts +1 -1
  49. package/dist/types/data/sx2Channel.d.ts +10 -0
  50. package/dist/types/demo/DemoYAxisPaddingControls.vue.d.ts +11 -0
  51. package/dist/types/demo/types.d.ts +7 -0
  52. package/dist/types/index.d.ts +2 -1
  53. package/dist/types/types/chart.d.ts +32 -8
  54. package/dist/types/types/controls.d.ts +69 -0
  55. package/dist/types/types/index.d.ts +2 -1
  56. package/dist/types/utils/formatters.d.ts +1 -0
  57. package/package.json +7 -6
  58. package/src/App.vue +61 -14
  59. package/src/components/WaveformChart.css +10 -1
  60. package/src/components/WaveformChart.vue +6 -0
  61. package/src/components/WaveformChartView.vue +27 -26
  62. package/src/components/annotation/WaveformAnnotationLayer.vue +6 -1
  63. package/src/components/annotation/useWaveformChartAnnotations.ts +7 -18
  64. package/src/components/controls/WaveformToolbar.vue +247 -0
  65. package/src/components/controls/chartExportOptions.ts +32 -0
  66. package/src/components/controls/chartSnapshot.ts +132 -0
  67. package/src/components/controls/snapshotTitle.ts +73 -0
  68. package/src/components/controls/toolbarRegistry.ts +92 -0
  69. package/src/components/controls/useChartCommands.ts +294 -0
  70. package/src/components/controls/useChartImageExport.ts +155 -0
  71. package/src/components/controls/useControlMode.ts +30 -0
  72. package/src/components/core/latestTaskScheduler.ts +14 -2
  73. package/src/components/core/layout.ts +49 -36
  74. package/src/components/core/niceScale.ts +151 -0
  75. package/src/components/core/trackLayoutBuilder.ts +41 -17
  76. package/src/components/core/trackPagination.ts +3 -3
  77. package/src/components/core/types.ts +5 -0
  78. package/src/components/core/useWaveformChartController.ts +94 -3
  79. package/src/components/core/useWaveformChartLifecycle.ts +11 -111
  80. package/src/components/core/useWaveformData.ts +4 -0
  81. package/src/components/core/useWaveformLayout.ts +25 -5
  82. package/src/components/core/useWaveformMeasurements.ts +63 -0
  83. package/src/components/core/useWaveformRenderSampling.ts +80 -59
  84. package/src/components/core/useWaveformViewportRestore.ts +105 -0
  85. package/src/components/core/useWaveformYAxisLayout.ts +3 -2
  86. package/src/components/core/waveformChartTypes.ts +5 -0
  87. package/src/components/core/waveformSamplingSession.ts +49 -0
  88. package/src/components/core/workerSamplingClient.ts +38 -6
  89. package/src/components/core/yAxisLabelStyle.ts +10 -0
  90. package/src/components/core/yAxisLayoutMetrics.ts +11 -9
  91. package/src/components/core/yAxisPadding.ts +60 -0
  92. package/src/components/core/yAxisTitleLayout.ts +11 -12
  93. package/src/components/interaction/useExtremaTickViewport.ts +43 -0
  94. package/src/components/interaction/useWaveformViewport.ts +11 -2
  95. package/src/components/rendering/WaveformTrack.css +1 -2
  96. package/src/components/rendering/WaveformTrack.vue +5 -12
  97. package/src/components/rendering/WaveformTrackAxes.vue +66 -19
  98. package/src/components/rendering/WaveformTrackBackdrop.vue +8 -3
  99. package/src/components/rendering/compactFrame.ts +31 -0
  100. package/src/components/rendering/yAxisTickVisibility.ts +156 -0
  101. package/src/core/lineBoundary.ts +24 -0
  102. package/src/core/rendering.ts +48 -25
  103. package/src/core/renderingStrategies.ts +19 -13
  104. package/src/core/waveformPointSource.ts +23 -1
  105. package/src/core/workerSampling/outputBoundaries.ts +32 -0
  106. package/src/core/workerSampling/repository.ts +26 -18
  107. package/src/core/workerSampling/repositoryDataset.ts +33 -1
  108. package/src/core/workerSampling/workerRuntime.ts +13 -3
  109. package/src/data/simulatedWaveforms.ts +67 -2
  110. package/src/data/sx2Channel.ts +315 -0
  111. package/src/demo/DemoChartHost.vue +5 -1
  112. package/src/demo/DemoGridFrameControls.vue +2 -0
  113. package/src/demo/DemoViewControls.vue +5 -2
  114. package/src/demo/DemoYAxisPaddingControls.vue +53 -0
  115. package/src/demo/embedBridge.ts +85 -0
  116. package/src/demo/types.ts +7 -0
  117. package/src/index.ts +19 -0
  118. package/src/types/chart.ts +34 -8
  119. package/src/types/controls.ts +80 -0
  120. package/src/types/index.ts +18 -0
  121. package/src/utils/formatters.ts +2 -1
  122. package/src/views/WasmSamplingDemo.vue +8 -1
@@ -0,0 +1,315 @@
1
+ // Original channel samples and timestamps, retained without resampling.
2
+ export const sx2Channel = {
3
+ chnl: 'SX2_7_01',
4
+ chnl_id: 1155,
5
+ dat_unit: 'V',
6
+ dev: 4,
7
+ shot: 13300,
8
+ time_unit: 'ms',
9
+ // prettier-ignore
10
+ data: [
11
+ 0.005035477225909801, 0.00747692072938122, 0.007171740291447293, 0.009918364232852639, 0.016021972991531186,
12
+ 0.006561379415579438, 0.008392462043183002, 0.013580529488059767, 0.01449607080186155, 0.019378957808804387,
13
+ 0.016021972991531186, 0.015411612115663331, 0.021820401312275806, 0.015106431677729404, 0.01571679255359726,
14
+ 0.012664988174257985, 0.015411612115663331, 0.016327153429465113, 0.017242694743266895, 0.01998931868467224,
15
+ 0.010223544670786566, 0.01449607080186155, 0.018158236057068677, 0.016937514305332968, 0.012664988174257985,
16
+ 0.014801251239795477, 0.018768596932936532, 0.011444266422522276, 0.004730296787975874, 0.00747692072938122,
17
+ 0.006561379415579438, 0.009613183794918712, 0.01571679255359726, 0.00869764248111693, 0.02029449912260617,
18
+ 0.01785305561913475, 0.01327534905012584, 0.016021972991531186, 0.012359807736324058, 0.010223544670786566,
19
+ 0.017547875181200823, 0.017242694743266895, 0.016937514305332968, 0.023041123064011515, 0.022735942626077588,
20
+ 0.01785305561913475, 0.019684138246738314, 0.01785305561913475, 0.017242694743266895, 0.015411612115663331,
21
+ 0.015411612115663331, 0.01571679255359726, 0.018158236057068677, 0.01327534905012584, 0.014801251239795477,
22
+ 0.007171740291447293, 0.014801251239795477, 0.014190890363927622, 0.011444266422522276, 0.016021972991531186,
23
+ 0.01205462729839013, 0.013885709925993694, 0.010528725108720494, 0.014190890363927622, 0.01571679255359726,
24
+ 0.01663233386739904, 0.011444266422522276, 0.013885709925993694, 0.01785305561913475, 0.015411612115663331,
25
+ 0.01907377737087046, 0.016327153429465113, 0.016021972991531186, 0.014801251239795477, 0.01785305561913475,
26
+ 0.019378957808804387, 0.018158236057068677, 0.017547875181200823, 0.01907377737087046, 0.018768596932936532,
27
+ 0.01998931868467224, 0.01785305561913475, 0.018768596932936532, 0.02029449912260617, 0.01998931868467224,
28
+ 0.023956664377813297, 0.022125581750209733, 0.024567025253681152, 0.02121004043640795, 0.027313649195086498,
29
+ 0.023346303501945442, 0.024567025253681152, 0.023041123064011515, 0.027313649195086498, 0.021515220874341878,
30
+ 0.023041123064011515, 0.02700846875715257, 0.02944991226062399, 0.029755092698557917, 0.028534370946822207,
31
+ 0.030975814450293626, 0.03189135576409541, 0.03433279926756683, 0.034637979705500754, 0.03158617532616148,
32
+ 0.0340276188296329, 0.03250171663996326, 0.031280994888227553, 0.036774242771038246, 0.0373846036469061,
33
+ 0.03189135576409541, 0.0306706340123597, 0.033417257953765045, 0.03372243839169897, 0.032196536202029336,
34
+ 0.0306706340123597, 0.035858701457236464, 0.035553521019302536, 0.030060273136491844, 0.03372243839169897,
35
+ 0.03372243839169897, 0.0306706340123597, 0.03036545357442577, 0.03189135576409541, 0.031280994888227553,
36
+ 0.03280689707789719, 0.03433279926756683, 0.033417257953765045, 0.031280994888227553, 0.028534370946822207,
37
+ 0.027618829633020425, 0.03433279926756683, 0.03250171663996326, 0.03250171663996326, 0.030975814450293626,
38
+ 0.033417257953765045, 0.03250171663996326, 0.030975814450293626, 0.02944991226062399, 0.037994964522773955,
39
+ 0.03433279926756683, 0.03158617532616148, 0.028534370946822207, 0.03768978408484003, 0.03494316014343468,
40
+ 0.0306706340123597, 0.029755092698557917, 0.03372243839169897, 0.035553521019302536, 0.030975814450293626,
41
+ 0.037994964522773955, 0.03646906233310432, 0.034637979705500754, 0.03372243839169897, 0.03768978408484003,
42
+ 0.033417257953765045, 0.03372243839169897, 0.03280689707789719, 0.037994964522773955, 0.040436408026245374,
43
+ 0.037994964522773955, 0.03158617532616148, 0.03616388189517039, 0.03860532539864181, 0.034637979705500754,
44
+ 0.03189135576409541, 0.04104676890211323, 0.03524834058136861, 0.0373846036469061, 0.030975814450293626,
45
+ 0.04165712977798108, 0.03372243839169897, 0.033417257953765045, 0.04318303196765072, 0.04013122758831145,
46
+ 0.037994964522773955, 0.03616388189517039, 0.03830014496070788, 0.03768978408484003, 0.039215686274509665,
47
+ 0.035858701457236464, 0.04196231021591501, 0.036774242771038246, 0.03707942320897217, 0.04226749065384894,
48
+ 0.03830014496070788, 0.03891050583657574, 0.0407415884641793, 0.04196231021591501, 0.03860532539864181,
49
+ 0.03891050583657574, 0.0440985732814525, 0.04440375371938643, 0.039215686274509665, 0.03860532539864181,
50
+ 0.045929655909056066, 0.04440375371938643, 0.0407415884641793, 0.03768978408484003, 0.045014114595254284,
51
+ 0.03982604715037752, 0.041351949340047156, 0.039215686274509665, 0.04684519722285785, 0.03646906233310432,
52
+ 0.03311207751583112, 0.03311207751583112, 0.0440985732814525, 0.03616388189517039, 0.03891050583657574,
53
+ 0.03494316014343468, 0.0440985732814525, 0.039215686274509665, 0.03280689707789719, 0.033417257953765045,
54
+ 0.04348821240558465, 0.03860532539864181, 0.03433279926756683, 0.03524834058136861, 0.034637979705500754,
55
+ 0.04196231021591501, 0.03891050583657574, 0.027618829633020425, 0.03646906233310432, 0.04531929503318821,
56
+ 0.03830014496070788, 0.032196536202029336, 0.03494316014343468, 0.03158617532616148, 0.04165712977798108,
57
+ 0.035553521019302536, 0.03311207751583112, 0.03830014496070788, 0.034637979705500754, 0.03311207751583112,
58
+ 0.035553521019302536, 0.042572671091782865, 0.03280689707789719, 0.032196536202029336, 0.03372243839169897,
59
+ 0.037994964522773955, 0.0340276188296329, 0.028534370946822207, 0.02700846875715257, 0.035553521019302536,
60
+ 0.03189135576409541, 0.026398107881284716, 0.030060273136491844, 0.03860532539864181, 0.03158617532616148,
61
+ 0.02700846875715257, 0.02700846875715257, 0.03707942320897217, 0.028839551384756135, 0.021820401312275806,
62
+ 0.028839551384756135, 0.036774242771038246, 0.03189135576409541, 0.029755092698557917, 0.02365148393987937,
63
+ 0.029144731822690062, 0.027313649195086498, 0.023956664377813297, 0.02578774700541686, 0.031280994888227553,
64
+ 0.027618829633020425, 0.02609292744335079, 0.025482566567482934, 0.025177386129549006, 0.02365148393987937,
65
+ 0.02365148393987937, 0.026398107881284716, 0.022125581750209733, 0.02121004043640795, 0.027924010070954353,
66
+ 0.021515220874341878, 0.021515220874341878, 0.02029449912260617, 0.01785305561913475, 0.024567025253681152,
67
+ 0.021515220874341878, 0.025177386129549006, 0.02243076218814366, 0.023346303501945442, 0.021820401312275806,
68
+ 0.02243076218814366, 0.016937514305332968, 0.023956664377813297, 0.022125581750209733, 0.022735942626077588,
69
+ 0.023041123064011515, 0.018768596932936532, 0.022735942626077588, 0.02487220569161508, 0.021515220874341878,
70
+ 0.022735942626077588, 0.019684138246738314, 0.02365148393987937, 0.02243076218814366, 0.018768596932936532,
71
+ 0.022735942626077588, 0.02609292744335079, 0.016937514305332968, 0.023956664377813297, 0.028839551384756135,
72
+ 0.021515220874341878, 0.024567025253681152, 0.026398107881284716, 0.028534370946822207, 0.03433279926756683,
73
+ 0.03860532539864181, 0.035553521019302536, 0.03158617532616148, 0.03189135576409541, 0.03189135576409541,
74
+ 0.03189135576409541, 0.035858701457236464, 0.03311207751583112, 0.028839551384756135, 0.026398107881284716,
75
+ 0.02609292744335079, 0.03189135576409541, 0.024567025253681152, 0.020904859998474024, 0.02243076218814366,
76
+ 0.030975814450293626, 0.025177386129549006, 0.02121004043640795, 0.018158236057068677, 0.02243076218814366,
77
+ 0.025482566567482934, 0.01998931868467224, 0.020599679560540096, 0.02029449912260617, 0.021515220874341878,
78
+ 0.02487220569161508, 0.02121004043640795, 0.02365148393987937, 0.027924010070954353, 0.019684138246738314,
79
+ 0.019684138246738314, 0.021515220874341878, 0.027618829633020425, 0.01907377737087046, 0.022125581750209733,
80
+ 0.017242694743266895, 0.020904859998474024, 0.019684138246738314, 0.02700846875715257, 0.021515220874341878,
81
+ 0.02487220569161508, 0.019684138246738314, 0.021820401312275806, 0.025177386129549006, 0.021820401312275806,
82
+ 0.02029449912260617, 0.01998931868467224, 0.01907377737087046, 0.021515220874341878, 0.026703288319218643,
83
+ 0.02578774700541686, 0.019684138246738314, 0.022735942626077588, 0.028839551384756135, 0.021515220874341878,
84
+ 0.02365148393987937, 0.02578774700541686, 0.03189135576409541, 0.025177386129549006, 0.02121004043640795,
85
+ 0.018768596932936532, 0.0340276188296329, 0.026398107881284716, 0.031280994888227553, 0.03311207751583112,
86
+ 0.02944991226062399, 0.035858701457236464, 0.028534370946822207, 0.027313649195086498, 0.023346303501945442,
87
+ 0.023346303501945442, 0.021820401312275806, 0.022735942626077588, 0.018463416495002605, 0.027618829633020425,
88
+ 0.018768596932936532, 0.032196536202029336, 0.027313649195086498, 0.029144731822690062, 0.023346303501945442,
89
+ 0.031280994888227553, 0.024567025253681152, 0.025177386129549006, 0.02578774700541686, 0.026703288319218643,
90
+ 0.020599679560540096, 0.035553521019302536, 0.027618829633020425, 0.026398107881284716, 0.03036545357442577,
91
+ 0.028534370946822207, 0.03372243839169897, 0.026398107881284716, 0.032196536202029336, 0.023346303501945442,
92
+ 0.025482566567482934, 0.029144731822690062, 0.041351949340047156, 0.039215686274509665, 0.04104676890211323,
93
+ 0.03646906233310432, 0.034637979705500754, 0.031280994888227553, 0.02487220569161508, 0.036774242771038246,
94
+ 0.02944991226062399, 0.030975814450293626, 0.030975814450293626, 0.02700846875715257, 0.034637979705500754,
95
+ 0.04165712977798108, 0.05508506904707389, 0.035858701457236464, 0.04013122758831145, 0.03280689707789719,
96
+ 0.03280689707789719, 0.024567025253681152, 0.03189135576409541, 0.03433279926756683, 0.030060273136491844,
97
+ 0.027618829633020425, 0.027924010070954353, 0.049591821164263195, 0.04318303196765072, 0.04531929503318821,
98
+ 0.03646906233310432, 0.039215686274509665, 0.03616388189517039, 0.03494316014343468, 0.03311207751583112,
99
+ 0.036774242771038246, 0.03707942320897217, 0.06576638437476134, 0.06424048218509171, 0.06851300831616669,
100
+ 0.06485084306095956, 0.06454566262302563, 0.063019760433356, 0.06576638437476134, 0.063019760433356,
101
+ 0.06515602349889349, 0.062104219119554216, 0.07858396276798629, 0.0886549172198059, 0.09414816510261659,
102
+ 0.09628442816815408, 0.10391393911650226, 0.10116731517509692, 0.10360875867856834, 0.15487907225146813,
103
+ 0.16647592889295737, 0.19272144655527512, 0.2159151598382536, 0.23117418173494997, 0.25253681239032666,
104
+ 0.27267872129396586, 0.2977035172045479, 0.32181277180132817, 0.3413443198290995, 0.3935301747158011,
105
+ 0.4194705119401849, 0.45456626230258657, 0.49576562142366676, 0.5152971694514381, 0.5091935606927596,
106
+ 0.5195696955825131, 0.5644312199588004, 0.5833524071107039, 0.6095979247730217, 0.6013580529488056,
107
+ 0.6355382619974055, 0.6440833142595555, 0.6511024643320358, 0.6657511253528643, 0.7124437323567552,
108
+ 0.7100022888532838, 0.6272983901731894, 0.35294117647058876, 0.3614862287327387, 0.35965514610513516,
109
+ 0.19394216830701083, 0.14358739604791282, 0.20950637064164113, 0.2708476386663623, 0.35507743953612625,
110
+ 0.41641870756084565, 0.36942092011902083, 0.2159151598382536, 0.29373617151140685, 0.37827115281910473,
111
+ 0.3587396047913334, 0.5485618371862362, 0.18326085297932337, 0.26901655603875874, 0.45456626230258657,
112
+ 0.3486686503395138, 0.3715571831845583, 0.16983291371023057, 0.20767528801403756, 0.2070649271381697,
113
+ 0.25467307545586415, 0.2998397802700854, 0.35416189822232447, 0.3880369268329904, 0.4719615472648204,
114
+ 0.43228809033340987, 0.4673838406958115, 0.503089951934081, 0.738384069581139, 0.29373617151140685,
115
+ 0.3077744716563675, 0.3669794766155494, 0.4515144579232473, 0.4261844815747313, 0.46799420157167937,
116
+ 0.2125581750209804, 0.2531471732661945, 0.30807965209430144, 0.3971923399710082, 0.4081788357366296,
117
+ 0.46890974288548115, 0.4469367513542384, 0.4753185320820936, 0.48661020828564894, 0.5549706263828487,
118
+ 0.515907530327306, 0.34592202639810843, 0.24063477531090172, 0.30289158464942467, 0.35751888303959767,
119
+ 0.17532616159304126, 0.1545738918135342, 0.2336156252384214, 0.31418326085298, 0.33707179369802454,
120
+ 0.36057068741893694, 0.16983291371023057, 0.22995345998321426, 0.3031967650873586, 0.30502784771496216,
121
+ 0.3187609674219889, 0.4707408255130847, 0.23086900129701604, 0.21408407721065004, 0.21622034027618753,
122
+ 0.2507057297627231, 0.3358510719462888, 0.30502784771496216, 0.26718547341115517, 0.24246585793850528,
123
+ 0.19272144655527512, 0.17318989852750377, 0.22171358815899822, 0.14877546349278958, 0.12832837415121645,
124
+ 0.11001754787518081, 0.0920119020370791, 0.07949950408178807, 0.06424048218509171, 0.05508506904707389,
125
+ 0.03372243839169897, 0.06790264744029884, 0.06057831692988458, 0.043793392843518575, 0.05355916685740425,
126
+ 0.03891050583657574, 0.03189135576409541, 0.02822919050888828, 0.026703288319218643, 0.06363012130922385,
127
+ 0.035553521019302536, 0.03524834058136861, 0.026398107881284716, 0.047150377660791776, 0.0407415884641793,
128
+ 0.02944991226062399, 0.040436408026245374, 0.04165712977798108, 0.027924010070954353, 0.035858701457236464,
129
+ 0.028839551384756135, 0.047150377660791776, 0.025482566567482934, 0.018463416495002605, 0.027313649195086498,
130
+ 0.004425116350041947, 0.021515220874341878, 0.013580529488059767, 0.023346303501945442, 0.024567025253681152,
131
+ 0.02822919050888828, 0.005035477225909801, 0.03982604715037752, 0.018463416495002605, 0.05020218204013105,
132
+ 0.026398107881284716, 0.01571679255359726, 0.023041123064011515, 0.047150377660791776, 0.00869764248111693,
133
+ 0.024567025253681152, 0.021515220874341878, 0.015106431677729404, 0.013580529488059767, 0.021820401312275806,
134
+ 0.0306706340123597, 0.018768596932936532, 0.024567025253681152, 0.05569542992294174, 0.027924010070954353,
135
+ 0.0306706340123597, 0.024261844815747224, 0.026703288319218643, 0.02029449912260617, 0.02822919050888828,
136
+ 0.01327534905012584, 0.026398107881284716, 0.02578774700541686, 0.023041123064011515, 0.022735942626077588,
137
+ 0.032196536202029336, 0.023346303501945442, 0.023346303501945442, 0.029144731822690062, 0.03280689707789719,
138
+ 0.028839551384756135, 0.02822919050888828, 0.0306706340123597, 0.0306706340123597, 0.027618829633020425,
139
+ 0.024261844815747224, 0.033417257953765045, 0.023956664377813297, 0.027313649195086498, 0.026703288319218643,
140
+ 0.0340276188296329, 0.02944991226062399, 0.0306706340123597, 0.03707942320897217, 0.03036545357442577,
141
+ 0.03433279926756683, 0.02822919050888828, 0.03830014496070788, 0.03158617532616148, 0.030975814450293626,
142
+ 0.03189135576409541, 0.03646906233310432, 0.03616388189517039, 0.037994964522773955, 0.030975814450293626,
143
+ 0.028839551384756135, 0.033417257953765045, 0.02822919050888828, 0.0407415884641793, 0.030975814450293626,
144
+ 0.029755092698557917, 0.029144731822690062, 0.035553521019302536, 0.03250171663996326, 0.03189135576409541,
145
+ 0.03372243839169897, 0.03494316014343468, 0.03189135576409541, 0.0306706340123597, 0.031280994888227553,
146
+ 0.030975814450293626, 0.0306706340123597, 0.03158617532616148, 0.03372243839169897, 0.030975814450293626,
147
+ 0.029755092698557917, 0.03036545357442577, 0.03250171663996326, 0.041351949340047156, 0.03311207751583112,
148
+ 0.03158617532616148, 0.030975814450293626, 0.027924010070954353, 0.031280994888227553, 0.03189135576409541,
149
+ 0.029755092698557917, 0.03311207751583112, 0.0306706340123597, 0.028534370946822207, 0.027924010070954353,
150
+ 0.0306706340123597, 0.03280689707789719, 0.032196536202029336, 0.0340276188296329, 0.029755092698557917,
151
+ 0.027313649195086498, 0.0306706340123597, 0.028534370946822207, 0.027313649195086498, 0.032196536202029336,
152
+ 0.02944991226062399, 0.0340276188296329, 0.027618829633020425, 0.02700846875715257, 0.03311207751583112,
153
+ 0.027924010070954353, 0.027924010070954353, 0.028839551384756135, 0.027313649195086498, 0.028534370946822207,
154
+ 0.03158617532616148, 0.026703288319218643, 0.024567025253681152, 0.028839551384756135, 0.02487220569161508,
155
+ 0.025177386129549006, 0.02365148393987937, 0.020599679560540096, 0.021820401312275806, 0.01998931868467224,
156
+ 0.022125581750209733, 0.0306706340123597, 0.027618829633020425, 0.02029449912260617, 0.024567025253681152,
157
+ 0.017242694743266895, 0.01907377737087046, 0.019684138246738314, 0.016021972991531186, 0.017547875181200823,
158
+ 0.01785305561913475, 0.018158236057068677, 0.018463416495002605, 0.019378957808804387, 0.013885709925993694,
159
+ 0.011749446860456203, 0.009918364232852639, 0.01907377737087046, 0.018768596932936532, 0.019378957808804387,
160
+ 0.01571679255359726, 0.017547875181200823, 0.018768596932936532, 0.010833905546654421, 0.012970168612191912,
161
+ 0.016327153429465113, 0.016021972991531186, 0.017547875181200823, 0.012359807736324058, 0.018463416495002605,
162
+ 0.016937514305332968, 0.018463416495002605, 0.01571679255359726, 0.01449607080186155, 0.014801251239795477,
163
+ 0.01663233386739904, 0.014801251239795477, 0.015106431677729404, 0.02121004043640795, 0.014801251239795477,
164
+ 0.013580529488059767, 0.011444266422522276, 0.012359807736324058, 0.015106431677729404, 0.009918364232852639,
165
+ 0.015411612115663331, 0.015411612115663331, 0.009918364232852639, 0.010833905546654421, 0.013580529488059767,
166
+ 0.01785305561913475, 0.01907377737087046, 0.01327534905012584, 0.010528725108720494, 0.011444266422522276,
167
+ 0.011444266422522276, 0.014801251239795477, 0.013580529488059767, 0.013580529488059767, 0.014190890363927622,
168
+ 0.012359807736324058, 0.01663233386739904, 0.018463416495002605, 0.01327534905012584, 0.010528725108720494,
169
+ 0.011444266422522276, 0.010833905546654421, 0.011444266422522276, 0.01205462729839013, 0.010223544670786566,
170
+ 0.00869764248111693, 0.015411612115663331, 0.012970168612191912, 0.01449607080186155, 0.015411612115663331,
171
+ 0.01327534905012584, 0.025177386129549006, 0.004730296787975874, 0.009613183794918712, 0.013580529488059767,
172
+ 0.009308003356984784, 0.011749446860456203, 0.012359807736324058, 0.012359807736324058, 0.009613183794918712,
173
+ 0.010223544670786566, 0.01327534905012584, 0.012970168612191912, 0.01327534905012584, 0.011749446860456203,
174
+ 0.010528725108720494, 0.01205462729839013, 0.0077821011673151474, 0.010833905546654421, 0.010223544670786566,
175
+ 0.011444266422522276, 0.008087281605249075, 0.011444266422522276, 0.011139085984588348, 0.008087281605249075,
176
+ 0.0077821011673151474, 0.01327534905012584, 0.009002822919050857, 0.009308003356984784, 0.011444266422522276,
177
+ 0.010223544670786566, 0.011749446860456203, 0.009918364232852639, 0.011139085984588348, 0.011139085984588348,
178
+ 0.010528725108720494, 0.009308003356984784, 0.009918364232852639, 0.00869764248111693, 0.010223544670786566,
179
+ 0.012359807736324058, 0.015411612115663331, 0.011139085984588348, 0.011139085984588348, 0.010833905546654421,
180
+ 0.009613183794918712, 0.008392462043183002, 0.011444266422522276, 0.011749446860456203, 0.008392462043183002,
181
+ 0.008392462043183002, 0.009308003356984784, 0.015411612115663331, 0.012359807736324058, 0.011139085984588348,
182
+ 0.012970168612191912, 0.008087281605249075, 0.009918364232852639, 0.011139085984588348, 0.009918364232852639,
183
+ 0.00869764248111693, 0.010223544670786566, 0.012359807736324058, 0.014190890363927622, 0.011749446860456203,
184
+ 0.009308003356984784, 0.009613183794918712, 0.012664988174257985, 0.00869764248111693, 0.011749446860456203,
185
+ 0.01327534905012584, 0.011749446860456203, 0.008392462043183002, 0.008087281605249075, 0.011444266422522276,
186
+ 0.01205462729839013, 0.011139085984588348, 0.011139085984588348, 0.012664988174257985, 0.008087281605249075,
187
+ 0.012664988174257985, 0.012359807736324058, 0.012664988174257985, 0.011444266422522276, 0.010223544670786566,
188
+ 0.012359807736324058, 0.010833905546654421, 0.011444266422522276, 0.010223544670786566, 0.011749446860456203,
189
+ 0.01327534905012584, 0.011139085984588348, 0.015106431677729404, 0.015106431677729404, 0.011749446860456203,
190
+ 0.01205462729839013, 0.01327534905012584, 0.009613183794918712, 0.016937514305332968, 0.009613183794918712,
191
+ 0.01205462729839013, 0.013885709925993694, 0.011749446860456203, 0.01449607080186155, 0.016327153429465113,
192
+ 0.01205462729839013, 0.015106431677729404, 0.01327534905012584, 0.01449607080186155, 0.012359807736324058,
193
+ 0.009002822919050857, 0.011444266422522276, 0.01449607080186155, 0.01205462729839013, 0.013580529488059767,
194
+ 0.011444266422522276, 0.013580529488059767, 0.011749446860456203, 0.018768596932936532, 0.01571679255359726,
195
+ 0.013885709925993694, 0.012970168612191912, 0.010833905546654421, 0.012359807736324058, 0.01205462729839013,
196
+ 0.01205462729839013, 0.01205462729839013, 0.013580529488059767, 0.014801251239795477, 0.011444266422522276,
197
+ 0.014190890363927622, 0.010528725108720494, 0.014190890363927622, 0.01327534905012584, 0.013580529488059767,
198
+ 0.018158236057068677, 0.01449607080186155, 0.012359807736324058, 0.012359807736324058, 0.011139085984588348,
199
+ 0.01327534905012584, 0.013885709925993694, 0.01571679255359726, 0.012359807736324058, 0.01327534905012584,
200
+ 0.010223544670786566, 0.013580529488059767, 0.014190890363927622, 0.012970168612191912, 0.016327153429465113,
201
+ 0.018768596932936532, 0.014801251239795477, 0.012664988174257985, 0.013580529488059767, 0.01571679255359726,
202
+ 0.016327153429465113, 0.01327534905012584, 0.013885709925993694, 0.01449607080186155, 0.012970168612191912,
203
+ 0.01205462729839013, 0.019684138246738314, 0.016021972991531186, 0.016937514305332968, 0.013580529488059767,
204
+ 0.00869764248111693, 0.01205462729839013, 0.013885709925993694, 0.012970168612191912, 0.010528725108720494,
205
+ 0.012664988174257985, 0.013885709925993694, 0.012359807736324058, 0.014190890363927622, 0.01205462729839013,
206
+ 0.011444266422522276, 0.016327153429465113, 0.016937514305332968, 0.012359807736324058, 0.01571679255359726,
207
+ 0.01205462729839013, 0.011749446860456203, 0.009613183794918712, 0.010223544670786566, 0.015411612115663331,
208
+ 0.013580529488059767, 0.014801251239795477, 0.010833905546654421, 0.01205462729839013, 0.013580529488059767,
209
+ 0.01205462729839013, 0.01785305561913475, 0.012664988174257985, 0.012970168612191912, 0.015106431677729404,
210
+ 0.01449607080186155, 0.01327534905012584, 0.01327534905012584, 0.012970168612191912, 0.01327534905012584,
211
+ ],
212
+ // prettier-ignore
213
+ time: [
214
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36,
215
+ 40, 44, 48, 52, 56, 60, 64, 68, 72, 76,
216
+ 80, 84, 88, 92, 96, 100, 104, 108, 112, 116,
217
+ 120, 124, 128, 132, 136, 140, 144, 148, 152, 156,
218
+ 160, 164, 168, 172, 176, 180, 184, 188, 192, 196,
219
+ 200, 204, 208, 212, 216, 220, 224, 228, 232, 236,
220
+ 240, 244, 248, 252, 256, 260, 264, 268, 272, 276,
221
+ 280, 284, 288, 292, 296, 300, 304, 308, 312, 316,
222
+ 320, 324, 328, 332, 336, 340, 344, 348, 352, 356,
223
+ 360, 364, 368, 372, 376, 380, 384, 388, 392, 396,
224
+ 400, 404, 408, 412, 416, 420, 424, 428, 432, 436,
225
+ 440, 444, 448, 452, 456, 460, 464, 468, 472, 476,
226
+ 480, 484, 488, 492, 496, 500, 504, 508, 512, 516,
227
+ 520, 524, 528, 532, 536, 540, 544, 548, 552, 556,
228
+ 560, 564, 568, 572, 576, 580, 584, 588, 592, 596,
229
+ 600, 604, 608, 612, 616, 620, 624, 628, 632, 636,
230
+ 640, 644, 648, 652, 656, 660, 664, 668, 672, 676,
231
+ 680, 684, 688, 692, 696, 700, 704, 708, 712, 716,
232
+ 720, 724, 728, 732, 736, 740, 744, 748, 752, 756,
233
+ 760, 764, 768, 772, 776, 780, 784, 788, 792, 796,
234
+ 800, 804, 808, 812, 816, 820, 824, 828, 832, 836,
235
+ 840, 844, 848, 852, 856, 860, 864, 868, 872, 876,
236
+ 880, 884, 888, 892, 896, 900, 904, 908, 912, 916,
237
+ 920, 924, 928, 932, 936, 940, 944, 948, 952, 956,
238
+ 960, 964, 968, 972, 976, 980, 984, 988, 992, 996,
239
+ 1000, 1004, 1008, 1012, 1016, 1020, 1024, 1028, 1032, 1036,
240
+ 1040, 1044, 1048, 1052, 1056, 1060, 1064, 1068, 1072, 1076,
241
+ 1080, 1084, 1088, 1092, 1096, 1100, 1104, 1108, 1112, 1116,
242
+ 1120, 1124, 1128, 1132, 1136, 1140, 1144, 1148, 1152, 1156,
243
+ 1160, 1164, 1168, 1172, 1176, 1180, 1184, 1188, 1192, 1196,
244
+ 1200, 1204, 1208, 1212, 1216, 1220, 1224, 1228, 1232, 1236,
245
+ 1240, 1244, 1248, 1252, 1256, 1260, 1264, 1268, 1272, 1276,
246
+ 1280, 1284, 1288, 1292, 1296, 1300, 1304, 1308, 1312, 1316,
247
+ 1320, 1324, 1328, 1332, 1336, 1340, 1344, 1348, 1352, 1356,
248
+ 1360, 1364, 1368, 1372, 1376, 1380, 1384, 1388, 1392, 1396,
249
+ 1400, 1404, 1408, 1412, 1416, 1420, 1424, 1428, 1432, 1436,
250
+ 1440, 1444, 1448, 1452, 1456, 1460, 1464, 1468, 1472, 1476,
251
+ 1480, 1484, 1488, 1492, 1496, 1500, 1504, 1508, 1512, 1516,
252
+ 1520, 1524, 1528, 1532, 1536, 1540, 1544, 1548, 1552, 1556,
253
+ 1560, 1564, 1568, 1572, 1576, 1580, 1584, 1588, 1592, 1596,
254
+ 1600, 1604, 1608, 1612, 1616, 1620, 1624, 1628, 1632, 1636,
255
+ 1640, 1644, 1648, 1652, 1656, 1660, 1664, 1668, 1672, 1676,
256
+ 1680, 1684, 1688, 1692, 1696, 1700, 1704, 1708, 1712, 1716,
257
+ 1720, 1724, 1728, 1732, 1736, 1740, 1744, 1748, 1752, 1756,
258
+ 1760, 1764, 1768, 1772, 1776, 1780, 1784, 1788, 1792, 1796,
259
+ 1800, 1804, 1808, 1812, 1816, 1820, 1824, 1828, 1832, 1836,
260
+ 1840, 1844, 1848, 1852, 1856, 1860, 1864, 1868, 1872, 1876,
261
+ 1880, 1884, 1888, 1892, 1896, 1900, 1904, 1908, 1912, 1916,
262
+ 1920, 1924, 1928, 1932, 1936, 1940, 1944, 1948, 1952, 1956,
263
+ 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996,
264
+ 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036,
265
+ 2040, 2044, 2048, 2052, 2056, 2060, 2064, 2068, 2072, 2076,
266
+ 2080, 2084, 2088, 2092, 2096, 2100, 2104, 2108, 2112, 2116,
267
+ 2120, 2124, 2128, 2132, 2136, 2140, 2144, 2148, 2152, 2156,
268
+ 2160, 2164, 2168, 2172, 2176, 2180, 2184, 2188, 2192, 2196,
269
+ 2200, 2204, 2208, 2212, 2216, 2220, 2224, 2228, 2232, 2236,
270
+ 2240, 2244, 2248, 2252, 2256, 2260, 2264, 2268, 2272, 2276,
271
+ 2280, 2284, 2288, 2292, 2296, 2300, 2304, 2308, 2312, 2316,
272
+ 2320, 2324, 2328, 2332, 2336, 2340, 2344, 2348, 2352, 2356,
273
+ 2360, 2364, 2368, 2372, 2376, 2380, 2384, 2388, 2392, 2396,
274
+ 2400, 2404, 2408, 2412, 2416, 2420, 2424, 2428, 2432, 2436,
275
+ 2440, 2444, 2448, 2452, 2456, 2460, 2464, 2468, 2472, 2476,
276
+ 2480, 2484, 2488, 2492, 2496, 2500, 2504, 2508, 2512, 2516,
277
+ 2520, 2524, 2528, 2532, 2536, 2540, 2544, 2548, 2552, 2556,
278
+ 2560, 2564, 2568, 2572, 2576, 2580, 2584, 2588, 2592, 2596,
279
+ 2600, 2604, 2608, 2612, 2616, 2620, 2624, 2628, 2632, 2636,
280
+ 2640, 2644, 2648, 2652, 2656, 2660, 2664, 2668, 2672, 2676,
281
+ 2680, 2684, 2688, 2692, 2696, 2700, 2704, 2708, 2712, 2716,
282
+ 2720, 2724, 2728, 2732, 2736, 2740, 2744, 2748, 2752, 2756,
283
+ 2760, 2764, 2768, 2772, 2776, 2780, 2784, 2788, 2792, 2796,
284
+ 2800, 2804, 2808, 2812, 2816, 2820, 2824, 2828, 2832, 2836,
285
+ 2840, 2844, 2848, 2852, 2856, 2860, 2864, 2868, 2872, 2876,
286
+ 2880, 2884, 2888, 2892, 2896, 2900, 2904, 2908, 2912, 2916,
287
+ 2920, 2924, 2928, 2932, 2936, 2940, 2944, 2948, 2952, 2956,
288
+ 2960, 2964, 2968, 2972, 2976, 2980, 2984, 2988, 2992, 2996,
289
+ 3000, 3004, 3008, 3012, 3016, 3020, 3024, 3028, 3032, 3036,
290
+ 3040, 3044, 3048, 3052, 3056, 3060, 3064, 3068, 3072, 3076,
291
+ 3080, 3084, 3088, 3092, 3096, 3100, 3104, 3108, 3112, 3116,
292
+ 3120, 3124, 3128, 3132, 3136, 3140, 3144, 3148, 3152, 3156,
293
+ 3160, 3164, 3168, 3172, 3176, 3180, 3184, 3188, 3192, 3196,
294
+ 3200, 3204, 3208, 3212, 3216, 3220, 3224, 3228, 3232, 3236,
295
+ 3240, 3244, 3248, 3252, 3256, 3260, 3264, 3268, 3272, 3276,
296
+ 3280, 3284, 3288, 3292, 3296, 3300, 3304, 3308, 3312, 3316,
297
+ 3320, 3324, 3328, 3332, 3336, 3340, 3344, 3348, 3352, 3356,
298
+ 3360, 3364, 3368, 3372, 3376, 3380, 3384, 3388, 3392, 3396,
299
+ 3400, 3404, 3408, 3412, 3416, 3420, 3424, 3428, 3432, 3436,
300
+ 3440, 3444, 3448, 3452, 3456, 3460, 3464, 3468, 3472, 3476,
301
+ 3480, 3484, 3488, 3492, 3496, 3500, 3504, 3508, 3512, 3516,
302
+ 3520, 3524, 3528, 3532, 3536, 3540, 3544, 3548, 3552, 3556,
303
+ 3560, 3564, 3568, 3572, 3576, 3580, 3584, 3588, 3592, 3596,
304
+ 3600, 3604, 3608, 3612, 3616, 3620, 3624, 3628, 3632, 3636,
305
+ 3640, 3644, 3648, 3652, 3656, 3660, 3664, 3668, 3672, 3676,
306
+ 3680, 3684, 3688, 3692, 3696, 3700, 3704, 3708, 3712, 3716,
307
+ 3720, 3724, 3728, 3732, 3736, 3740, 3744, 3748, 3752, 3756,
308
+ 3760, 3764, 3768, 3772, 3776, 3780, 3784, 3788, 3792, 3796,
309
+ 3800, 3804, 3808, 3812, 3816, 3820, 3824, 3828, 3832, 3836,
310
+ 3840, 3844, 3848, 3852, 3856, 3860, 3864, 3868, 3872, 3876,
311
+ 3880, 3884, 3888, 3892, 3896, 3900, 3904, 3908, 3912, 3916,
312
+ 3920, 3924, 3928, 3932, 3936, 3940, 3944, 3948, 3952, 3956,
313
+ 3960, 3964, 3968, 3972, 3976, 3980, 3984, 3988, 3992, 3999.999,
314
+ ],
315
+ }
@@ -19,6 +19,8 @@ defineExpose({ resetViewport })
19
19
  <section class="chart-panel">
20
20
  <WaveformChart
21
21
  ref="waveformChartRef"
22
+ layout-preset="edge-compact"
23
+ unit-display-mode="channel-label"
22
24
  v-model:annotations="model.annotations"
23
25
  v-model:hidden-series-ids="model.hiddenSeriesIds"
24
26
  :data="model.data"
@@ -50,7 +52,9 @@ defineExpose({ resetViewport })
50
52
  :zero-line="model.zeroLine"
51
53
  :frame-number="model.frameWatermarkVisible ? 1 : undefined"
52
54
  :annotations-visible="model.annotationsVisible"
53
- :interaction-mode="model.interactionMode"
55
+ v-model:interaction-mode="model.interactionMode"
56
+ :toolbar="model.toolbarVisible"
57
+ pannable
54
58
  @zoom-end="model.handleZoomEnd"
55
59
  @zoom-reset="model.resetWaveformViewport"
56
60
  />
@@ -2,12 +2,14 @@
2
2
  import { InputNumber, Select, Switch } from 'ant-design-vue'
3
3
  import { ColorPicker } from 'vue3-colorpicker'
4
4
 
5
+ import DemoYAxisPaddingControls from './DemoYAxisPaddingControls.vue'
5
6
  import type { DemoControlPanelModel } from './types'
6
7
 
7
8
  const model = defineModel<DemoControlPanelModel>('model', { required: true })
8
9
  </script>
9
10
 
10
11
  <template>
12
+ <DemoYAxisPaddingControls v-model:model="model" />
11
13
  <section class="control-section">
12
14
  <h2>绘图区边距</h2>
13
15
  <div class="plot-margin-controls">
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { Button, InputNumber, Radio, Select, Switch } from 'ant-design-vue'
2
+ import { InputNumber, Radio, Select, Switch } from 'ant-design-vue'
3
3
 
4
4
  import type { DemoControlPanelModel } from './types'
5
5
 
@@ -36,7 +36,10 @@ const model = defineModel<DemoControlPanelModel>('model', { required: true })
36
36
  </section>
37
37
  <section class="control-section">
38
38
  <h2>视图</h2>
39
- <Button block aria-label="重置波形视图" @click="model.resetWaveformViewport"> 重置视图 </Button>
39
+ <label class="frame-style-control frame-style-control--switch">
40
+ <span>内置工具栏</span>
41
+ <Switch v-model:checked="model.toolbarVisible" size="small" aria-label="显示内置工具栏" />
42
+ </label>
40
43
  <div class="auxiliary-style-controls" style="margin-top: 10px">
41
44
  <label class="frame-style-control frame-style-control--switch">
42
45
  <span>整数缩放</span>
@@ -0,0 +1,53 @@
1
+ <script setup lang="ts">
2
+ import { InputNumber, Switch } from 'ant-design-vue'
3
+ import type { DemoControlPanelModel } from './types'
4
+ const model = defineModel<DemoControlPanelModel>('model', { required: true })
5
+ </script>
6
+
7
+ <template>
8
+ <section class="control-section">
9
+ <h2>Y 轴留白</h2>
10
+ <div v-for="side in ['upper', 'lower'] as const" :key="side" class="y-axis-padding-control">
11
+ <span>{{ side === 'upper' ? '上方留白' : '下方留白' }}</span>
12
+ <Switch
13
+ v-model:checked="model[`${side}PaddingEnabled`]"
14
+ size="small"
15
+ :aria-label="side === 'upper' ? '上方留白' : '下方留白'"
16
+ />
17
+ <InputNumber
18
+ v-model:value="model[`${side}PaddingPercent`]"
19
+ :min="0"
20
+ :step="1"
21
+ :disabled="!model[`${side}PaddingEnabled`]"
22
+ addon-after="%"
23
+ size="small"
24
+ :aria-label="side === 'upper' ? '上方留白比例' : '下方留白比例'"
25
+ />
26
+ </div>
27
+ <div class="y-axis-padding-control extrema-control">
28
+ <span>显示最值刻度</span>
29
+ <Switch v-model:checked="model.extremaTicksVisible" size="small" aria-label="显示最值刻度" />
30
+ </div>
31
+ <small>仅作用于自动 Y 范围;刻度取整可能增加实际留白。</small>
32
+ </section>
33
+ </template>
34
+
35
+ <style scoped>
36
+ .y-axis-padding-control {
37
+ display: grid;
38
+ grid-template-columns: 60px 28px minmax(0, 1fr);
39
+ align-items: center;
40
+ gap: 8px;
41
+ margin-bottom: 10px;
42
+ font-size: 12px;
43
+ }
44
+ .y-axis-padding-control :deep(.ant-switch) {
45
+ justify-self: start;
46
+ }
47
+ .y-axis-padding-control :deep(.ant-input-number) {
48
+ width: 100%;
49
+ }
50
+ .extrema-control {
51
+ grid-template-columns: 1fr auto;
52
+ }
53
+ </style>
@@ -0,0 +1,85 @@
1
+ import type { Router } from 'vue-router'
2
+
3
+ type EmbedMessage =
4
+ | { type: 'ready'; appKey: string }
5
+ | { type: 'route-change'; appKey: string; route: string }
6
+ | { type: 'resize'; appKey: string; height: number }
7
+
8
+ const routeLimit = 2048
9
+
10
+ export function installDemoEmbedBridge(router: Router) {
11
+ const hostOrigin = trustedHostOrigin()
12
+ if (!hostOrigin) return () => undefined
13
+
14
+ const post = (message: EmbedMessage) => window.parent.postMessage(message, hostOrigin)
15
+ const requestedRoute = safeRoute(new URLSearchParams(window.location.search).get('childRoute'))
16
+ let active = false
17
+
18
+ const removeRouteHook = router.afterEach((route) => {
19
+ if (!active) return
20
+ post({
21
+ type: 'route-change',
22
+ appKey: appKey(),
23
+ route: route.fullPath,
24
+ })
25
+ })
26
+ const observer = new ResizeObserver(() =>
27
+ post({
28
+ type: 'resize',
29
+ appKey: appKey(),
30
+ height: Math.ceil(document.documentElement.scrollHeight),
31
+ }),
32
+ )
33
+ observer.observe(document.documentElement)
34
+ void router.isReady().then(async () => {
35
+ if (requestedRoute && requestedRoute !== router.currentRoute.value.fullPath)
36
+ await router.replace(requestedRoute)
37
+ active = true
38
+ post({ type: 'ready', appKey: appKey() })
39
+ post({ type: 'route-change', appKey: appKey(), route: router.currentRoute.value.fullPath })
40
+ post({
41
+ type: 'resize',
42
+ appKey: appKey(),
43
+ height: Math.ceil(document.documentElement.scrollHeight),
44
+ })
45
+ })
46
+
47
+ return () => {
48
+ removeRouteHook()
49
+ observer.disconnect()
50
+ }
51
+ }
52
+
53
+ function appKey() {
54
+ return import.meta.env.VITE_EMBED_APP_KEY || 'waveform-analysis'
55
+ }
56
+
57
+ function trustedHostOrigin() {
58
+ const configured = import.meta.env.VITE_EMBED_HOST_ORIGIN
59
+ if (!configured || window.parent === window) return null
60
+ try {
61
+ const expected = new URL(configured).origin
62
+ return new URL(document.referrer).origin === expected ? expected : null
63
+ } catch {
64
+ return null
65
+ }
66
+ }
67
+
68
+ function safeRoute(value: string | null) {
69
+ if (
70
+ !value ||
71
+ value.length > routeLimit ||
72
+ !value.startsWith('/') ||
73
+ Array.from(value).some(
74
+ (character) => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127,
75
+ )
76
+ )
77
+ return null
78
+ try {
79
+ return new URL(value, 'https://waveform.invalid').origin === 'https://waveform.invalid'
80
+ ? value
81
+ : null
82
+ } catch {
83
+ return null
84
+ }
85
+ }
package/src/demo/types.ts CHANGED
@@ -23,6 +23,7 @@ interface SelectOption<T> {
23
23
  }
24
24
 
25
25
  export interface DemoControlPanelModel {
26
+ toolbarVisible: boolean
26
27
  controlsOpen: boolean
27
28
  displayMode: WaveformDisplayMode
28
29
  overlayMode: WaveformOverlayMode
@@ -50,6 +51,11 @@ export interface DemoControlPanelModel {
50
51
  verticalGridColor: string
51
52
  xAxisLineVisible: boolean
52
53
  yAxisLineVisible: boolean
54
+ upperPaddingEnabled: boolean
55
+ lowerPaddingEnabled: boolean
56
+ extremaTicksVisible: boolean
57
+ upperPaddingPercent: number
58
+ lowerPaddingPercent: number
53
59
  xAxisLabelFormatterEnabled: boolean
54
60
  xAxisLabelFormat: DemoXAxisLabelFormat
55
61
  xAxisLabelFormatOptions: Array<SelectOption<DemoXAxisLabelFormat>>
@@ -87,6 +93,7 @@ export interface DemoControlPanelModel {
87
93
  }
88
94
 
89
95
  export interface DemoChartModel {
96
+ toolbarVisible: boolean
90
97
  data: WaveformData
91
98
  initialXDomain?: [number, number]
92
99
  displayMode: WaveformDisplayMode
package/src/index.ts CHANGED
@@ -40,7 +40,9 @@ export type {
40
40
  WaveformXAxisLabelKind,
41
41
  WaveformXAxisLabelFormatterContext,
42
42
  WaveformXAxisLabelFormatter,
43
+ // Includes axes.y.extremaTicksVisible for independent extrema tick visibility.
43
44
  WaveformAxesOptions,
45
+ WaveformYAxisLabelTextStyle,
44
46
  WaveformZeroLineOptions,
45
47
  // 数据类型
46
48
  SingleWaveformData,
@@ -97,3 +99,20 @@ export {
97
99
  } from './core'
98
100
 
99
101
  export { parseWaveformAnnotations, serializeWaveformAnnotations } from './components/annotation'
102
+
103
+ export type {
104
+ WaveformToolbarItem,
105
+ WaveformToolbarOptions,
106
+ WaveformControlTarget,
107
+ WaveformControlAction,
108
+ WaveformCommandMetadata,
109
+ WaveformTargetStatus,
110
+ WaveformViewportSnapshot,
111
+ WaveformTargetResult,
112
+ WaveformControlResult,
113
+ WaveformControlState,
114
+ WaveformImageExportOptions,
115
+ WaveformImageExportErrorCode,
116
+ WaveformImageExportError,
117
+ WaveformChartHandle,
118
+ } from './types/controls'