waveform-analysis 0.1.35 → 0.1.36
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 +6 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +128 -131
- package/dist/style.css +1 -1
- package/dist/types/components/core/types.d.ts +2 -0
- package/dist/types/components/interaction/WaveformTooltip.vue.d.ts +1 -0
- package/dist/types/types/data.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/core/types.ts +2 -0
- package/src/components/interaction/WaveformTooltip.test.ts +17 -9
- package/src/components/interaction/WaveformTooltip.vue +41 -45
- package/src/components/interaction/useWaveformHover.ts +1 -0
- package/src/components/waveformChartCases/compactAndSharedHover.test.ts +4 -4
- package/src/components/waveformChartCases/dataAndHoverPerformance.test.ts +2 -2
- package/src/core/data.test.ts +22 -0
- package/src/core/data.ts +1 -0
- package/src/data/simulatedWaveforms.test.ts +1 -0
- package/src/data/simulatedWaveforms.ts +7 -1
- package/src/types/data.ts +3 -0
- package/src/views/FixedYDomainDemo.vue +2 -0
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.waveform-annotation-layer[data-v-7254383e]{pointer-events:none}.waveform-annotation-layer--interactive .waveform-annotation[data-v-7254383e]{pointer-events:auto;cursor:grab;touch-action:none}.waveform-annotation-layer--interactive .waveform-annotation[data-v-7254383e]:active{cursor:grabbing}.waveform-annotation__arrow[data-v-7254383e]{stroke-width:2px;stroke-linecap:round;pointer-events:none}.waveform-annotation__box[data-v-7254383e]{stroke-width:1px;rx:3}.waveform-annotation-layer--interactive .waveform-annotation__box[data-v-7254383e]{pointer-events:auto}.waveform-annotation__text[data-v-7254383e]{pointer-events:none;-webkit-user-select:none;user-select:none}.waveform-annotation-context-menu[data-v-c70c98a1]{z-index:30;background:#fff;border:1px solid #dfe5ef;border-radius:4px;min-width:112px;padding:4px;display:grid;position:absolute;box-shadow:0 4px 14px #10182829}.waveform-annotation-context-menu button[data-v-c70c98a1]{color:#344054;text-align:left;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:3px;padding:7px 10px;font-size:12px}.waveform-annotation-context-menu button[data-v-c70c98a1]:hover{background:#f2f4f7}.waveform-annotation-editor[data-v-52818b45]{z-index:40;background:#10182852;place-items:center;padding:20px;animation:.16s ease-out waveform-annotation-editor-fade-in-52818b45;display:grid;position:absolute;inset:0}.waveform-annotation-editor__panel[data-v-52818b45]{color:#344054;background:#fff;border:1px solid #e4e7ec;border-radius:12px;gap:20px;width:min(440px,100%);max-height:100%;padding:22px;font-size:13px;animation:.18s ease-out waveform-annotation-editor-rise-in-52818b45;display:grid;overflow-y:auto;box-shadow:0 20px 50px #10182838}.waveform-annotation-editor__header[data-v-52818b45]{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.waveform-annotation-editor__header h2[data-v-52818b45]{color:#101828;margin:0;font-size:18px;line-height:1.3}.waveform-annotation-editor__header p[data-v-52818b45]{color:#667085;margin:5px 0 0;font-size:12px}.waveform-annotation-editor__close[data-v-52818b45]{color:#667085;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:0 0 30px;place-items:center;width:30px;height:30px;padding:0;font-size:22px;line-height:1;display:inline-grid}.waveform-annotation-editor__close[data-v-52818b45]:hover{color:#101828;background:#f2f4f7}.waveform-annotation-editor__coordinates[data-v-52818b45]{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.waveform-annotation-editor__coordinates span[data-v-52818b45],.waveform-annotation-editor__series[data-v-52818b45]{background:#f8fafc;border:1px solid #eaecf0;border-radius:7px;align-items:center;gap:8px;min-width:0;padding:9px 10px;display:flex}.waveform-annotation-editor__coordinates span[data-v-52818b45]{color:#667085}.waveform-annotation-editor__coordinates b[data-v-52818b45]{color:#1677ff;font-size:11px}.waveform-annotation-editor__coordinates code[data-v-52818b45]{color:#344054;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;overflow:hidden}.waveform-annotation-editor__series[data-v-52818b45]{gap:10px}.waveform-annotation-editor__series i[data-v-52818b45]{border:1px solid #0000001f;border-radius:2px;flex:0 0 12px;width:12px;height:12px}.waveform-annotation-editor__series-label[data-v-52818b45]{gap:1px;min-width:0;display:grid}.waveform-annotation-editor__series select[data-v-52818b45]{color:#344054;min-width:0;max-width:190px;font:inherit;background:#fff;border:1px solid #d0d5dd;border-radius:5px;margin-left:auto;padding:5px 7px}.waveform-annotation-editor__series small[data-v-52818b45]{color:#667085;font-size:10px}.waveform-annotation-editor__series b[data-v-52818b45]{color:#344054;text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.waveform-annotation-editor__series code[data-v-52818b45]{color:#667085;margin-left:auto;font-size:11px}.waveform-annotation-editor__field[data-v-52818b45],.waveform-annotation-editor__color-field[data-v-52818b45]{gap:4px;display:grid}.waveform-annotation-editor__label-row[data-v-52818b45]{justify-content:space-between;align-items:center;gap:8px;display:flex}.waveform-annotation-editor__label-row b[data-v-52818b45],.waveform-annotation-editor__colors legend[data-v-52818b45]{color:#344054;font-size:12px;font-weight:600}.waveform-annotation-editor__label-row small[data-v-52818b45]{color:#98a2b3;font-size:11px}.waveform-annotation-editor textarea[data-v-52818b45]{box-sizing:border-box;color:#1d2939;width:100%;min-height:92px;font:inherit;resize:vertical;background:#fff;border:1px solid #d0d5dd;border-radius:7px;padding:10px 11px;line-height:1.5}.waveform-annotation-editor textarea[data-v-52818b45]:focus{border-color:#1677ff;outline:3px solid #1677ff24}.waveform-annotation-editor__colors[data-v-52818b45]{border:0;border-top:1px solid #eaecf0;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;min-width:0;margin:0;padding:14px 0 0;display:grid}.waveform-annotation-editor__colors legend[data-v-52818b45]{grid-column:1/-1;padding:0}.waveform-annotation-editor__color-field[data-v-52818b45]{color:#667085;text-align:left;place-items:stretch stretch;min-width:0;font-size:11px}.waveform-annotation-editor__color-field[data-v-52818b45] .vc-color-wrap{border:1px solid #cfd5df;border-radius:6px;width:100%;height:34px;margin-right:0;box-shadow:inset 0 0 0 1px #ffffff61}.waveform-annotation-editor__color-field[data-v-52818b45] .vc-color-wrap:hover{border-color:#98a2b3;box-shadow:0 0 0 3px #1677ff1f}.waveform-annotation-editor__actions[data-v-52818b45]{border-top:1px solid #eaecf0;justify-content:flex-end;gap:8px;padding-top:8px;display:flex}.waveform-annotation-editor__actions button[data-v-52818b45]{color:#475467;cursor:pointer;background:#fff;border:1px solid #d0d5dd;border-radius:6px;height:34px;padding:0 12px}.waveform-annotation-editor__actions button.is-primary[data-v-52818b45]{color:#fff;background:#1677ff;border-color:#1677ff}.waveform-annotation-editor__actions button[data-v-52818b45]:disabled{opacity:.45;cursor:not-allowed}@keyframes waveform-annotation-editor-fade-in-52818b45{0%{opacity:0}to{opacity:1}}@keyframes waveform-annotation-editor-rise-in-52818b45{0%{opacity:0;transform:translateY(8px)scale(.98)}to{opacity:1;transform:translateY(0)scale(1)}}@media (width<=420px){.waveform-annotation-editor[data-v-52818b45]{padding:12px}.waveform-annotation-editor__panel[data-v-52818b45]{gap:16px;padding:18px}.waveform-annotation-editor__coordinates[data-v-52818b45]{grid-template-columns:1fr}}.waveform-tooltip[data-v-93daa641]{box-sizing:border-box;z-index:2;color:#333;pointer-events:none;background:#fff;border:1px solid #d9d9d9;border-radius:2px;gap:3px;width:max-content;max-width:min(320px,100% - 16px);padding:8px 10px;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;display:grid;position:absolute;box-shadow:0 4px 12px #1018281f}.waveform-tooltip__time[data-v-93daa641]{border-bottom:1px solid #f0f0f0;padding-bottom:4px}.waveform-tooltip__series[data-v-93daa641]{grid-template-columns:8px minmax(0,1fr);align-items:start;gap:6px;display:grid}.waveform-tooltip__series i[data-v-93daa641]{border-radius:50%;flex:none;width:8px;height:8px;margin-top:4px}.waveform-tooltip__series-content[data-v-93daa641]{overflow-wrap:anywhere;white-space:normal;min-width:0}.waveform-tooltip__series strong[data-v-93daa641]{font-weight:600}.waveform-tooltip__value[data-v-93daa641]{overflow-wrap:anywhere}.waveform-tooltip__series small[data-v-93daa641]{color:#667085}.waveform-track__line[data-v-42a3fd47]{fill:none;stroke-width:1.5px;stroke-linejoin:round;stroke-linecap:round}.waveform-track__error-bar[data-v-42a3fd47]{fill:none}.waveform-track__point[data-v-42a3fd47],.waveform-track__error-bar[data-v-42a3fd47]{pointer-events:none}.waveform-track{isolation:isolate;pointer-events:none}.waveform-track__y-axis-label-bg{fill:#fff;opacity:.9;pointer-events:none}.waveform-track__y-axis-label{pointer-events:none;font-size:12px;font-weight:500}.waveform-track__grid{pointer-events:none}.waveform-track__grid--major line{stroke:#dfe5ef;stroke-width:1px}.waveform-track__grid--minor line{stroke:#f2f5fa;stroke-width:1px}.waveform-track__plot-frame,.waveform-track__plot-background{pointer-events:none}.waveform-track__watermark{fill:#1677ff1a;pointer-events:none;-webkit-user-select:none;user-select:none;font-family:Consolas,Monaco,Courier New,monospace}.waveform-track__overlay{fill:#0000;cursor:crosshair;pointer-events:all;touch-action:none}.waveform-track__no-visible-series{fill:#8c8c8c;pointer-events:none;font:13px sans-serif}.waveform-track__overlay.is-zoomable{cursor:grab}.waveform-track__overlay.is-zoomable:active{cursor:grabbing}.waveform-track__overlay.is-annotating{cursor:crosshair}.waveform-track__overlay.is-presentation{cursor:default;pointer-events:none}.waveform-track__zero-line{fill:none;pointer-events:none}.waveform-track__axis-endpoint{fill:#667085;pointer-events:none;font-size:11px}.waveform-track__axis-exponent{fill:#666;font-family:sans-serif;font-size:10px}.waveform-track__axis path,.waveform-track__axis line{stroke:#1f2937}.waveform-track__axis text{fill:#667085;font-size:11px}.waveform-legend[data-v-2ae12e71]{pointer-events:none;overflow:hidden}.waveform-legend__viewport[data-v-2ae12e71]{box-sizing:border-box;width:100%;height:100%;padding:8px;display:flex;overflow:hidden}.waveform-legend__viewport--top-left[data-v-2ae12e71]{justify-content:flex-start;align-items:flex-start}.waveform-legend__viewport--top[data-v-2ae12e71]{justify-content:center;align-items:flex-start}.waveform-legend__viewport--top-right[data-v-2ae12e71]{justify-content:flex-end;align-items:flex-start}.waveform-legend__viewport--right[data-v-2ae12e71]{justify-content:flex-end;align-items:center}.waveform-legend__viewport--bottom-right[data-v-2ae12e71]{justify-content:flex-end;align-items:flex-end}.waveform-legend__viewport--bottom[data-v-2ae12e71]{justify-content:center;align-items:flex-end}.waveform-legend__viewport--bottom-left[data-v-2ae12e71]{justify-content:flex-start;align-items:flex-end}.waveform-legend__viewport--left[data-v-2ae12e71]{justify-content:flex-start;align-items:center}.waveform-legend__panel[data-v-2ae12e71]{color:#344054;border:1px solid #d0d5dde6;border-radius:4px;flex:0 auto;gap:5px 12px;max-width:100%;max-height:100%;padding:5px 7px;font:12px/1.35 sans-serif;display:flex;overflow:hidden}.waveform-legend__panel--interactive[data-v-2ae12e71]{pointer-events:auto}.waveform-legend__panel--horizontal[data-v-2ae12e71]{flex-flow:wrap;align-items:center}.waveform-legend__panel--vertical[data-v-2ae12e71]{flex-flow:column;align-items:stretch}.waveform-legend__item[data-v-2ae12e71]{min-width:0;max-width:160px;color:inherit;font:inherit;text-align:left;white-space:nowrap;appearance:none;background:0 0;border:0;align-items:center;gap:6px;padding:0;display:flex}.waveform-legend__item[data-v-2ae12e71]:disabled{opacity:1}.waveform-legend__panel--interactive .waveform-legend__item[data-v-2ae12e71]{cursor:pointer}.waveform-legend__panel--interactive .waveform-legend__item[data-v-2ae12e71]:focus-visible{outline-offset:2px;outline:2px solid #1677ff}.waveform-legend__item.is-hidden[data-v-2ae12e71]{opacity:.45}.waveform-legend__item.is-hidden .waveform-legend__label[data-v-2ae12e71]{text-decoration:line-through}.waveform-legend__swatch[data-v-2ae12e71]{stroke-linecap:round;stroke-linejoin:round;flex:0 0 26px;width:26px;height:16px;overflow:visible}.waveform-legend__label[data-v-2ae12e71]{text-overflow:ellipsis;min-width:0;overflow:hidden}.waveform-track__crosshair[data-v-a6f82099]{pointer-events:none}.waveform-track__crosshair line[data-v-a6f82099]{stroke:#57617b;stroke-width:1px;stroke-dasharray:4 3}.waveform-chart{box-sizing:border-box;color:#475467;background:#fff;border:1px solid #00000014;border-radius:6px;min-width:0;min-height:180px;position:relative;overflow:hidden}.waveform-chart--clean{border-color:#0000}.waveform-chart__pagination{z-index:2;position:absolute;bottom:6px;right:10px}.waveform-chart__title-area{background:#fff;align-items:center;width:100%;min-width:0;padding:0 24px;display:flex;position:relative;overflow:hidden}.waveform-chart__title-measure{visibility:hidden;pointer-events:none;display:block;position:absolute}.waveform-chart__title-visual{flex:none;min-width:0;position:relative;overflow:visible}.waveform-chart__title-text{transform-origin:50%;line-height:1.2;display:block;position:absolute;top:50%;left:50%;overflow:visible}.waveform-chart__pagination .ant-pagination-item,.waveform-chart__pagination .ant-pagination-prev .ant-pagination-item-link,.waveform-chart__pagination .ant-pagination-next .ant-pagination-item-link{background:#fff;border-color:#d9d9d9}.waveform-chart__pagination .ant-pagination-item-active{border-color:#1677ff}.waveform-chart__grid-slot-placeholder{fill:#fafbfc;stroke:#e4e7ec;stroke-dasharray:4 4;pointer-events:none}.waveform-chart__svg{max-width:100%;display:block}.waveform-chart__overlay{fill:#0000;cursor:crosshair;touch-action:none}.waveform-chart__overlay.is-zoomable{cursor:crosshair}.waveform-chart--panning .waveform-chart__overlay.is-zoomable{cursor:grabbing}.waveform-chart__zoom-selection{fill:#1677ff24;stroke:#1677ff;stroke-width:1px;pointer-events:none}.waveform-chart__overlay.is-annotating{cursor:crosshair}.waveform-chart--presentation .waveform-chart__overlay{cursor:default;pointer-events:none}.waveform-chart__label,.waveform-chart__empty{fill:#595959;font-size:12px}
|
|
1
|
+
.waveform-annotation-layer[data-v-7254383e]{pointer-events:none}.waveform-annotation-layer--interactive .waveform-annotation[data-v-7254383e]{pointer-events:auto;cursor:grab;touch-action:none}.waveform-annotation-layer--interactive .waveform-annotation[data-v-7254383e]:active{cursor:grabbing}.waveform-annotation__arrow[data-v-7254383e]{stroke-width:2px;stroke-linecap:round;pointer-events:none}.waveform-annotation__box[data-v-7254383e]{stroke-width:1px;rx:3}.waveform-annotation-layer--interactive .waveform-annotation__box[data-v-7254383e]{pointer-events:auto}.waveform-annotation__text[data-v-7254383e]{pointer-events:none;-webkit-user-select:none;user-select:none}.waveform-annotation-context-menu[data-v-c70c98a1]{z-index:30;background:#fff;border:1px solid #dfe5ef;border-radius:4px;min-width:112px;padding:4px;display:grid;position:absolute;box-shadow:0 4px 14px #10182829}.waveform-annotation-context-menu button[data-v-c70c98a1]{color:#344054;text-align:left;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:3px;padding:7px 10px;font-size:12px}.waveform-annotation-context-menu button[data-v-c70c98a1]:hover{background:#f2f4f7}.waveform-annotation-editor[data-v-52818b45]{z-index:40;background:#10182852;place-items:center;padding:20px;animation:.16s ease-out waveform-annotation-editor-fade-in-52818b45;display:grid;position:absolute;inset:0}.waveform-annotation-editor__panel[data-v-52818b45]{color:#344054;background:#fff;border:1px solid #e4e7ec;border-radius:12px;gap:20px;width:min(440px,100%);max-height:100%;padding:22px;font-size:13px;animation:.18s ease-out waveform-annotation-editor-rise-in-52818b45;display:grid;overflow-y:auto;box-shadow:0 20px 50px #10182838}.waveform-annotation-editor__header[data-v-52818b45]{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.waveform-annotation-editor__header h2[data-v-52818b45]{color:#101828;margin:0;font-size:18px;line-height:1.3}.waveform-annotation-editor__header p[data-v-52818b45]{color:#667085;margin:5px 0 0;font-size:12px}.waveform-annotation-editor__close[data-v-52818b45]{color:#667085;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:0 0 30px;place-items:center;width:30px;height:30px;padding:0;font-size:22px;line-height:1;display:inline-grid}.waveform-annotation-editor__close[data-v-52818b45]:hover{color:#101828;background:#f2f4f7}.waveform-annotation-editor__coordinates[data-v-52818b45]{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.waveform-annotation-editor__coordinates span[data-v-52818b45],.waveform-annotation-editor__series[data-v-52818b45]{background:#f8fafc;border:1px solid #eaecf0;border-radius:7px;align-items:center;gap:8px;min-width:0;padding:9px 10px;display:flex}.waveform-annotation-editor__coordinates span[data-v-52818b45]{color:#667085}.waveform-annotation-editor__coordinates b[data-v-52818b45]{color:#1677ff;font-size:11px}.waveform-annotation-editor__coordinates code[data-v-52818b45]{color:#344054;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;overflow:hidden}.waveform-annotation-editor__series[data-v-52818b45]{gap:10px}.waveform-annotation-editor__series i[data-v-52818b45]{border:1px solid #0000001f;border-radius:2px;flex:0 0 12px;width:12px;height:12px}.waveform-annotation-editor__series-label[data-v-52818b45]{gap:1px;min-width:0;display:grid}.waveform-annotation-editor__series select[data-v-52818b45]{color:#344054;min-width:0;max-width:190px;font:inherit;background:#fff;border:1px solid #d0d5dd;border-radius:5px;margin-left:auto;padding:5px 7px}.waveform-annotation-editor__series small[data-v-52818b45]{color:#667085;font-size:10px}.waveform-annotation-editor__series b[data-v-52818b45]{color:#344054;text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.waveform-annotation-editor__series code[data-v-52818b45]{color:#667085;margin-left:auto;font-size:11px}.waveform-annotation-editor__field[data-v-52818b45],.waveform-annotation-editor__color-field[data-v-52818b45]{gap:4px;display:grid}.waveform-annotation-editor__label-row[data-v-52818b45]{justify-content:space-between;align-items:center;gap:8px;display:flex}.waveform-annotation-editor__label-row b[data-v-52818b45],.waveform-annotation-editor__colors legend[data-v-52818b45]{color:#344054;font-size:12px;font-weight:600}.waveform-annotation-editor__label-row small[data-v-52818b45]{color:#98a2b3;font-size:11px}.waveform-annotation-editor textarea[data-v-52818b45]{box-sizing:border-box;color:#1d2939;width:100%;min-height:92px;font:inherit;resize:vertical;background:#fff;border:1px solid #d0d5dd;border-radius:7px;padding:10px 11px;line-height:1.5}.waveform-annotation-editor textarea[data-v-52818b45]:focus{border-color:#1677ff;outline:3px solid #1677ff24}.waveform-annotation-editor__colors[data-v-52818b45]{border:0;border-top:1px solid #eaecf0;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;min-width:0;margin:0;padding:14px 0 0;display:grid}.waveform-annotation-editor__colors legend[data-v-52818b45]{grid-column:1/-1;padding:0}.waveform-annotation-editor__color-field[data-v-52818b45]{color:#667085;text-align:left;place-items:stretch stretch;min-width:0;font-size:11px}.waveform-annotation-editor__color-field[data-v-52818b45] .vc-color-wrap{border:1px solid #cfd5df;border-radius:6px;width:100%;height:34px;margin-right:0;box-shadow:inset 0 0 0 1px #ffffff61}.waveform-annotation-editor__color-field[data-v-52818b45] .vc-color-wrap:hover{border-color:#98a2b3;box-shadow:0 0 0 3px #1677ff1f}.waveform-annotation-editor__actions[data-v-52818b45]{border-top:1px solid #eaecf0;justify-content:flex-end;gap:8px;padding-top:8px;display:flex}.waveform-annotation-editor__actions button[data-v-52818b45]{color:#475467;cursor:pointer;background:#fff;border:1px solid #d0d5dd;border-radius:6px;height:34px;padding:0 12px}.waveform-annotation-editor__actions button.is-primary[data-v-52818b45]{color:#fff;background:#1677ff;border-color:#1677ff}.waveform-annotation-editor__actions button[data-v-52818b45]:disabled{opacity:.45;cursor:not-allowed}@keyframes waveform-annotation-editor-fade-in-52818b45{0%{opacity:0}to{opacity:1}}@keyframes waveform-annotation-editor-rise-in-52818b45{0%{opacity:0;transform:translateY(8px)scale(.98)}to{opacity:1;transform:translateY(0)scale(1)}}@media (width<=420px){.waveform-annotation-editor[data-v-52818b45]{padding:12px}.waveform-annotation-editor__panel[data-v-52818b45]{gap:16px;padding:18px}.waveform-annotation-editor__coordinates[data-v-52818b45]{grid-template-columns:1fr}}.waveform-tooltip[data-v-1f55d6c8]{box-sizing:border-box;z-index:2;color:#505050;pointer-events:none;background:#fff;border:1px solid #e3e7eb;border-radius:4px;gap:2px;width:max-content;max-width:min(560px,100% - 16px);padding:9px 12px;font:14px/1.35 Arial,sans-serif;display:grid;position:absolute;box-shadow:0 3px 10px #10182826}.waveform-tooltip__series[data-v-1f55d6c8]{grid-template-columns:8px minmax(0,1fr);align-items:start;gap:6px;display:grid}.waveform-tooltip__series i[data-v-1f55d6c8]{border-radius:50%;flex:none;width:8px;height:8px;margin-top:4px}.waveform-tooltip__series-content[data-v-1f55d6c8]{flex-wrap:nowrap;align-items:baseline;gap:12px;min-width:0;display:flex}.waveform-tooltip__series-label[data-v-1f55d6c8]{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}.waveform-tooltip__value[data-v-1f55d6c8]{white-space:nowrap;flex:none}.waveform-tooltip__series strong[data-v-1f55d6c8]{font-weight:600}.waveform-tooltip__value[data-v-1f55d6c8]{color:#555}.waveform-tooltip__series small[data-v-1f55d6c8]{color:#667085}.waveform-track__line[data-v-42a3fd47]{fill:none;stroke-width:1.5px;stroke-linejoin:round;stroke-linecap:round}.waveform-track__error-bar[data-v-42a3fd47]{fill:none}.waveform-track__point[data-v-42a3fd47],.waveform-track__error-bar[data-v-42a3fd47]{pointer-events:none}.waveform-track{isolation:isolate;pointer-events:none}.waveform-track__y-axis-label-bg{fill:#fff;opacity:.9;pointer-events:none}.waveform-track__y-axis-label{pointer-events:none;font-size:12px;font-weight:500}.waveform-track__grid{pointer-events:none}.waveform-track__grid--major line{stroke:#dfe5ef;stroke-width:1px}.waveform-track__grid--minor line{stroke:#f2f5fa;stroke-width:1px}.waveform-track__plot-frame,.waveform-track__plot-background{pointer-events:none}.waveform-track__watermark{fill:#1677ff1a;pointer-events:none;-webkit-user-select:none;user-select:none;font-family:Consolas,Monaco,Courier New,monospace}.waveform-track__overlay{fill:#0000;cursor:crosshair;pointer-events:all;touch-action:none}.waveform-track__no-visible-series{fill:#8c8c8c;pointer-events:none;font:13px sans-serif}.waveform-track__overlay.is-zoomable{cursor:grab}.waveform-track__overlay.is-zoomable:active{cursor:grabbing}.waveform-track__overlay.is-annotating{cursor:crosshair}.waveform-track__overlay.is-presentation{cursor:default;pointer-events:none}.waveform-track__zero-line{fill:none;pointer-events:none}.waveform-track__axis-endpoint{fill:#667085;pointer-events:none;font-size:11px}.waveform-track__axis-exponent{fill:#666;font-family:sans-serif;font-size:10px}.waveform-track__axis path,.waveform-track__axis line{stroke:#1f2937}.waveform-track__axis text{fill:#667085;font-size:11px}.waveform-legend[data-v-2ae12e71]{pointer-events:none;overflow:hidden}.waveform-legend__viewport[data-v-2ae12e71]{box-sizing:border-box;width:100%;height:100%;padding:8px;display:flex;overflow:hidden}.waveform-legend__viewport--top-left[data-v-2ae12e71]{justify-content:flex-start;align-items:flex-start}.waveform-legend__viewport--top[data-v-2ae12e71]{justify-content:center;align-items:flex-start}.waveform-legend__viewport--top-right[data-v-2ae12e71]{justify-content:flex-end;align-items:flex-start}.waveform-legend__viewport--right[data-v-2ae12e71]{justify-content:flex-end;align-items:center}.waveform-legend__viewport--bottom-right[data-v-2ae12e71]{justify-content:flex-end;align-items:flex-end}.waveform-legend__viewport--bottom[data-v-2ae12e71]{justify-content:center;align-items:flex-end}.waveform-legend__viewport--bottom-left[data-v-2ae12e71]{justify-content:flex-start;align-items:flex-end}.waveform-legend__viewport--left[data-v-2ae12e71]{justify-content:flex-start;align-items:center}.waveform-legend__panel[data-v-2ae12e71]{color:#344054;border:1px solid #d0d5dde6;border-radius:4px;flex:0 auto;gap:5px 12px;max-width:100%;max-height:100%;padding:5px 7px;font:12px/1.35 sans-serif;display:flex;overflow:hidden}.waveform-legend__panel--interactive[data-v-2ae12e71]{pointer-events:auto}.waveform-legend__panel--horizontal[data-v-2ae12e71]{flex-flow:wrap;align-items:center}.waveform-legend__panel--vertical[data-v-2ae12e71]{flex-flow:column;align-items:stretch}.waveform-legend__item[data-v-2ae12e71]{min-width:0;max-width:160px;color:inherit;font:inherit;text-align:left;white-space:nowrap;appearance:none;background:0 0;border:0;align-items:center;gap:6px;padding:0;display:flex}.waveform-legend__item[data-v-2ae12e71]:disabled{opacity:1}.waveform-legend__panel--interactive .waveform-legend__item[data-v-2ae12e71]{cursor:pointer}.waveform-legend__panel--interactive .waveform-legend__item[data-v-2ae12e71]:focus-visible{outline-offset:2px;outline:2px solid #1677ff}.waveform-legend__item.is-hidden[data-v-2ae12e71]{opacity:.45}.waveform-legend__item.is-hidden .waveform-legend__label[data-v-2ae12e71]{text-decoration:line-through}.waveform-legend__swatch[data-v-2ae12e71]{stroke-linecap:round;stroke-linejoin:round;flex:0 0 26px;width:26px;height:16px;overflow:visible}.waveform-legend__label[data-v-2ae12e71]{text-overflow:ellipsis;min-width:0;overflow:hidden}.waveform-track__crosshair[data-v-a6f82099]{pointer-events:none}.waveform-track__crosshair line[data-v-a6f82099]{stroke:#57617b;stroke-width:1px;stroke-dasharray:4 3}.waveform-chart{box-sizing:border-box;color:#475467;background:#fff;border:1px solid #00000014;border-radius:6px;min-width:0;min-height:180px;position:relative;overflow:hidden}.waveform-chart--clean{border-color:#0000}.waveform-chart__pagination{z-index:2;position:absolute;bottom:6px;right:10px}.waveform-chart__title-area{background:#fff;align-items:center;width:100%;min-width:0;padding:0 24px;display:flex;position:relative;overflow:hidden}.waveform-chart__title-measure{visibility:hidden;pointer-events:none;display:block;position:absolute}.waveform-chart__title-visual{flex:none;min-width:0;position:relative;overflow:visible}.waveform-chart__title-text{transform-origin:50%;line-height:1.2;display:block;position:absolute;top:50%;left:50%;overflow:visible}.waveform-chart__pagination .ant-pagination-item,.waveform-chart__pagination .ant-pagination-prev .ant-pagination-item-link,.waveform-chart__pagination .ant-pagination-next .ant-pagination-item-link{background:#fff;border-color:#d9d9d9}.waveform-chart__pagination .ant-pagination-item-active{border-color:#1677ff}.waveform-chart__grid-slot-placeholder{fill:#fafbfc;stroke:#e4e7ec;stroke-dasharray:4 4;pointer-events:none}.waveform-chart__svg{max-width:100%;display:block}.waveform-chart__overlay{fill:#0000;cursor:crosshair;touch-action:none}.waveform-chart__overlay.is-zoomable{cursor:crosshair}.waveform-chart--panning .waveform-chart__overlay.is-zoomable{cursor:grabbing}.waveform-chart__zoom-selection{fill:#1677ff24;stroke:#1677ff;stroke-width:1px;pointer-events:none}.waveform-chart__overlay.is-annotating{cursor:crosshair}.waveform-chart--presentation .waveform-chart__overlay{cursor:default;pointer-events:none}.waveform-chart__label,.waveform-chart__empty{fill:#595959;font-size:12px}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -6,6 +6,7 @@ import type { NormalizedWaveformGridLineOptions } from './grid';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface DisplaySeries {
|
|
8
8
|
id: string;
|
|
9
|
+
shotNo?: string;
|
|
9
10
|
trackId?: string;
|
|
10
11
|
name: string;
|
|
11
12
|
unit?: string;
|
|
@@ -52,6 +53,7 @@ export interface WaveformYAxisLayout {
|
|
|
52
53
|
*/
|
|
53
54
|
export interface HoveredSeriesPoint {
|
|
54
55
|
id: string;
|
|
56
|
+
shotNo?: string;
|
|
55
57
|
name: string;
|
|
56
58
|
unit?: string;
|
|
57
59
|
color: string;
|
|
@@ -33,6 +33,8 @@ export type SingleWaveformData = {
|
|
|
33
33
|
*/
|
|
34
34
|
export interface WaveformSeries {
|
|
35
35
|
id?: string;
|
|
36
|
+
/** 炮号,未提供时 Tooltip 显示“未配置炮号”。 */
|
|
37
|
+
shotNo?: string;
|
|
36
38
|
/** 相同 trackId 的系列叠加在同一图框中;默认每个系列独占一个图框。 */
|
|
37
39
|
trackId?: string;
|
|
38
40
|
name: string;
|
|
@@ -56,6 +58,7 @@ export type WaveformData = SingleWaveformData | {
|
|
|
56
58
|
*/
|
|
57
59
|
export interface NormalizedWaveformSeries {
|
|
58
60
|
id: string;
|
|
61
|
+
shotNo?: string;
|
|
59
62
|
trackId?: string;
|
|
60
63
|
name: string;
|
|
61
64
|
unit?: string;
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import type { NormalizedWaveformGridLineOptions } from './grid'
|
|
|
13
13
|
*/
|
|
14
14
|
export interface DisplaySeries {
|
|
15
15
|
id: string
|
|
16
|
+
shotNo?: string
|
|
16
17
|
trackId?: string
|
|
17
18
|
name: string
|
|
18
19
|
unit?: string
|
|
@@ -63,6 +64,7 @@ export interface WaveformYAxisLayout {
|
|
|
63
64
|
*/
|
|
64
65
|
export interface HoveredSeriesPoint {
|
|
65
66
|
id: string
|
|
67
|
+
shotNo?: string
|
|
66
68
|
name: string
|
|
67
69
|
unit?: string
|
|
68
70
|
color: string
|
|
@@ -80,7 +80,7 @@ describe('WaveformTooltip', () => {
|
|
|
80
80
|
expect(tooltip.attributes('style')).toContain('max-width: 280px')
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
it('
|
|
83
|
+
it('omits units and errors from the strict x/y value format', () => {
|
|
84
84
|
const pointWithErrors = { x: 1, y: 12, error: 1, upperError: 2 }
|
|
85
85
|
const wrapper = mount(WaveformTooltip, {
|
|
86
86
|
props: {
|
|
@@ -102,10 +102,12 @@ describe('WaveformTooltip', () => {
|
|
|
102
102
|
},
|
|
103
103
|
})
|
|
104
104
|
|
|
105
|
-
expect(wrapper.get('.waveform-
|
|
105
|
+
expect(wrapper.get('.waveform-tooltip__value').text()).toBe('(x:1 y:12)')
|
|
106
|
+
expect(wrapper.get('.waveform-tooltip__value').text()).not.toContain('C')
|
|
107
|
+
expect(wrapper.get('.waveform-tooltip__value').text()).not.toContain('+2')
|
|
106
108
|
})
|
|
107
109
|
|
|
108
|
-
it('
|
|
110
|
+
it('renders the configured shot number, channel, and formatted coordinates', () => {
|
|
109
111
|
const hoveredPoint = { x: 1, y: -1405.4932 }
|
|
110
112
|
const wrapper = mount(WaveformTooltip, {
|
|
111
113
|
props: {
|
|
@@ -117,6 +119,7 @@ describe('WaveformTooltip', () => {
|
|
|
117
119
|
{
|
|
118
120
|
trackIndex: 0,
|
|
119
121
|
name: 'ENG8KJXAc(10001)',
|
|
122
|
+
shotNo: '炮 7',
|
|
120
123
|
color: '#ffb43b',
|
|
121
124
|
unit: 'A',
|
|
122
125
|
point: hoveredPoint,
|
|
@@ -127,26 +130,31 @@ describe('WaveformTooltip', () => {
|
|
|
127
130
|
},
|
|
128
131
|
})
|
|
129
132
|
|
|
130
|
-
expect(wrapper.get('.waveform-
|
|
133
|
+
expect(wrapper.get('.waveform-tooltip__series-label').text()).toBe('炮 7: ENG8KJXAc(10001)(A)')
|
|
134
|
+
expect(wrapper.get('.waveform-tooltip__value').text()).toBe('(x:1,000 y:-1,405.4932)')
|
|
131
135
|
})
|
|
132
136
|
|
|
133
|
-
it('
|
|
137
|
+
it('renders each series row with the formatted x coordinate and series label', () => {
|
|
134
138
|
const wrapper = mount(WaveformTooltip, {
|
|
135
139
|
props: {
|
|
136
140
|
visible: true,
|
|
137
141
|
position: { x: 10, y: 10 },
|
|
138
142
|
timeUnit: 's',
|
|
139
143
|
hoveredPoint: { x: 1.234567, y: 12 },
|
|
140
|
-
seriesPoints: [
|
|
144
|
+
seriesPoints: [
|
|
145
|
+
{ trackIndex: 0, name: '温度', color: '#f00', point: { x: 1.234567, y: 12 } },
|
|
146
|
+
],
|
|
141
147
|
containerWidth: 400,
|
|
142
148
|
containerHeight: 300,
|
|
143
149
|
},
|
|
144
150
|
})
|
|
145
151
|
|
|
146
|
-
expect(wrapper.
|
|
152
|
+
expect(wrapper.find('.waveform-tooltip__time').exists()).toBe(false)
|
|
153
|
+
expect(wrapper.get('.waveform-tooltip__series-label').text()).toBe('未配置炮号: 温度')
|
|
154
|
+
expect(wrapper.get('.waveform-tooltip__value').text()).toBe('(x:1.2346 y:12)')
|
|
147
155
|
})
|
|
148
156
|
|
|
149
|
-
it('
|
|
157
|
+
it('uses the fallback shot number when shotNo is blank', () => {
|
|
150
158
|
const point = { x: 1, y: 12 }
|
|
151
159
|
const wrapper = mount(WaveformTooltip, {
|
|
152
160
|
props: {
|
|
@@ -160,6 +168,6 @@ describe('WaveformTooltip', () => {
|
|
|
160
168
|
},
|
|
161
169
|
})
|
|
162
170
|
|
|
163
|
-
expect(wrapper.
|
|
171
|
+
expect(wrapper.get('.waveform-tooltip__series-label').text()).toBe('未配置炮号: 温度')
|
|
164
172
|
})
|
|
165
173
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
-
import { resolveWaveformPointErrors } from '../../core'
|
|
4
3
|
import { formatTooltipNumber, formatTooltipTime } from '../../utils'
|
|
5
4
|
import type { WaveformPoint } from '../data/types'
|
|
6
5
|
|
|
7
6
|
interface SeriesPoint {
|
|
8
7
|
trackIndex: number
|
|
9
8
|
name: string
|
|
9
|
+
shotNo?: string
|
|
10
10
|
color: string
|
|
11
11
|
unit?: string
|
|
12
12
|
point: WaveformPoint
|
|
@@ -34,7 +34,7 @@ const props = defineProps<Props>()
|
|
|
34
34
|
const tooltipGap = 12
|
|
35
35
|
const containerPadding = 8
|
|
36
36
|
const tooltipPlacementWidth = 238
|
|
37
|
-
const tooltipMaxWidth =
|
|
37
|
+
const tooltipMaxWidth = 560
|
|
38
38
|
const tooltipHorizontalPadding = 20
|
|
39
39
|
const tooltipLineHeight = 20
|
|
40
40
|
|
|
@@ -45,18 +45,18 @@ function estimateLineCount(text: string, width: number): number {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function formatSeriesText(seriesPoint: SeriesPoint): string {
|
|
48
|
-
const
|
|
49
|
-
return `${seriesPoint.
|
|
50
|
-
seriesPoint.unit ? `
|
|
51
|
-
}
|
|
48
|
+
const timeText = formatTooltipTime(props.hoveredPoint?.x ?? seriesPoint.point.x, props.timeUnit)
|
|
49
|
+
return `${seriesPoint.shotNo?.trim() || '未配置炮号'}: ${seriesPoint.name}${
|
|
50
|
+
seriesPoint.unit ? `(${seriesPoint.unit})` : ''
|
|
51
|
+
} (x:${timeText} y:${formatTooltipNumber(seriesPoint.point.y)})`
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function estimateTooltipHeight(width: number
|
|
54
|
+
function estimateTooltipHeight(width: number): number {
|
|
55
55
|
const seriesLines = props.seriesPoints.reduce(
|
|
56
56
|
(total, seriesPoint) => total + estimateLineCount(formatSeriesText(seriesPoint), width),
|
|
57
57
|
0,
|
|
58
58
|
)
|
|
59
|
-
return 16 + tooltipLineHeight *
|
|
59
|
+
return 16 + tooltipLineHeight * seriesLines + 5
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const tooltipStyle = computed(() => {
|
|
@@ -84,25 +84,18 @@ const tooltipStyle = computed(() => {
|
|
|
84
84
|
: { left: `${containerPadding}px`, maxWidth: `${availableWidth}px` }
|
|
85
85
|
|
|
86
86
|
const maxWidth = Number.parseFloat(horizontalStyle.maxWidth)
|
|
87
|
-
const timeText = `${props.timeUnit}: ${formatTooltipTime(props.hoveredPoint.x, props.timeUnit)}`
|
|
88
|
-
|
|
89
87
|
return {
|
|
90
88
|
...horizontalStyle,
|
|
91
89
|
top: `${Math.max(
|
|
92
90
|
8,
|
|
93
91
|
Math.min(
|
|
94
92
|
props.position.y - 18,
|
|
95
|
-
props.containerHeight - estimateTooltipHeight(maxWidth
|
|
93
|
+
props.containerHeight - estimateTooltipHeight(maxWidth) - 8,
|
|
96
94
|
),
|
|
97
95
|
)}px`,
|
|
98
96
|
}
|
|
99
97
|
})
|
|
100
98
|
|
|
101
|
-
function formatError(point: WaveformPoint): string | null {
|
|
102
|
-
const { lower, upper } = resolveWaveformPointErrors(point)
|
|
103
|
-
if (lower === 0 && upper === 0) return null
|
|
104
|
-
return `(+${formatTooltipNumber(upper)} / -${formatTooltipNumber(lower)})`
|
|
105
|
-
}
|
|
106
99
|
</script>
|
|
107
100
|
|
|
108
101
|
<template>
|
|
@@ -111,9 +104,6 @@ function formatError(point: WaveformPoint): string | null {
|
|
|
111
104
|
class="waveform-tooltip waveform-chart__tooltip"
|
|
112
105
|
:style="tooltipStyle"
|
|
113
106
|
>
|
|
114
|
-
<span class="waveform-tooltip__time waveform-chart__tooltip-time">
|
|
115
|
-
{{ timeUnit }}: {{ formatTooltipTime(hoveredPoint.x, timeUnit) }}
|
|
116
|
-
</span>
|
|
117
107
|
<span
|
|
118
108
|
v-for="seriesPoint in seriesPoints"
|
|
119
109
|
:key="`${seriesPoint.trackIndex}-${seriesPoint.name}`"
|
|
@@ -121,12 +111,12 @@ function formatError(point: WaveformPoint): string | null {
|
|
|
121
111
|
>
|
|
122
112
|
<i :style="{ backgroundColor: seriesPoint.color }" />
|
|
123
113
|
<span class="waveform-tooltip__series-content">
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
</span>
|
|
114
|
+
<span class="waveform-tooltip__series-label">{{ seriesPoint.shotNo?.trim() || '未配置炮号' }}: {{
|
|
115
|
+
seriesPoint.name
|
|
116
|
+
}}<template v-if="seriesPoint.unit">({{ seriesPoint.unit }})</template></span>
|
|
117
|
+
<span class="waveform-tooltip__value">(x:{{ formatTooltipTime(hoveredPoint.x, timeUnit) }} y:{{
|
|
118
|
+
formatTooltipNumber(seriesPoint.point.y)
|
|
119
|
+
}})</span>
|
|
130
120
|
</span>
|
|
131
121
|
</span>
|
|
132
122
|
</div>
|
|
@@ -138,26 +128,17 @@ function formatError(point: WaveformPoint): string | null {
|
|
|
138
128
|
position: absolute;
|
|
139
129
|
z-index: 2;
|
|
140
130
|
display: grid;
|
|
141
|
-
gap:
|
|
131
|
+
gap: 2px;
|
|
142
132
|
width: max-content;
|
|
143
|
-
max-width: min(
|
|
144
|
-
padding:
|
|
145
|
-
color: #
|
|
146
|
-
font:
|
|
147
|
-
12px/1.45 ui-monospace,
|
|
148
|
-
SFMono-Regular,
|
|
149
|
-
Consolas,
|
|
150
|
-
monospace;
|
|
133
|
+
max-width: min(560px, calc(100% - 16px));
|
|
134
|
+
padding: 9px 12px;
|
|
135
|
+
color: #505050;
|
|
136
|
+
font: 14px/1.35 Arial, sans-serif;
|
|
151
137
|
pointer-events: none;
|
|
152
138
|
background: #fff;
|
|
153
|
-
border: 1px solid #
|
|
154
|
-
border-radius:
|
|
155
|
-
box-shadow: 0
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.waveform-tooltip__time {
|
|
159
|
-
padding-bottom: 4px;
|
|
160
|
-
border-bottom: 1px solid #f0f0f0;
|
|
139
|
+
border: 1px solid #e3e7eb;
|
|
140
|
+
border-radius: 4px;
|
|
141
|
+
box-shadow: 0 3px 10px rgb(16 24 40 / 15%);
|
|
161
142
|
}
|
|
162
143
|
|
|
163
144
|
.waveform-tooltip__series {
|
|
@@ -176,9 +157,24 @@ function formatError(point: WaveformPoint): string | null {
|
|
|
176
157
|
}
|
|
177
158
|
|
|
178
159
|
.waveform-tooltip__series-content {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-wrap: nowrap;
|
|
162
|
+
gap: 12px;
|
|
163
|
+
align-items: baseline;
|
|
164
|
+
min-width: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.waveform-tooltip__series-label {
|
|
168
|
+
flex: 1 1 auto;
|
|
179
169
|
min-width: 0;
|
|
180
|
-
overflow
|
|
181
|
-
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
text-overflow: ellipsis;
|
|
172
|
+
white-space: nowrap;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.waveform-tooltip__value {
|
|
176
|
+
flex: 0 0 auto;
|
|
177
|
+
white-space: nowrap;
|
|
182
178
|
}
|
|
183
179
|
|
|
184
180
|
.waveform-tooltip__series strong {
|
|
@@ -186,7 +182,7 @@ function formatError(point: WaveformPoint): string | null {
|
|
|
186
182
|
}
|
|
187
183
|
|
|
188
184
|
.waveform-tooltip__value {
|
|
189
|
-
|
|
185
|
+
color: #555;
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
.waveform-tooltip__series small {
|
|
@@ -179,10 +179,10 @@ describe('WaveformChart', () => {
|
|
|
179
179
|
await flushPromises()
|
|
180
180
|
|
|
181
181
|
const tooltip = wrapper.get('.waveform-chart__tooltip')
|
|
182
|
-
expect(tooltip.text()).toContain('BT2_2M
|
|
183
|
-
expect(tooltip.text()).toContain('2
|
|
184
|
-
expect(tooltip.text()).toContain('BT1_2M
|
|
185
|
-
expect(tooltip.text()).toContain('4
|
|
182
|
+
expect(tooltip.text()).toContain('未配置炮号: BT2_2M')
|
|
183
|
+
expect(tooltip.text()).toContain('(x:1,000 y:2)')
|
|
184
|
+
expect(tooltip.text()).toContain('未配置炮号: BT1_2M')
|
|
185
|
+
expect(tooltip.text()).toContain('(x:1,000 y:4)')
|
|
186
186
|
const crosshairLines = wrapper.findAll('.waveform-chart__crosshair line')
|
|
187
187
|
expect(crosshairLines).toHaveLength(2)
|
|
188
188
|
crosshairLines.forEach((line) => {
|
|
@@ -178,7 +178,7 @@ describe('WaveformChart', () => {
|
|
|
178
178
|
await flushPromises()
|
|
179
179
|
expect(wrapper.emitted('point-hover')?.at(-1)).toEqual([{ x: 1, y: 5 }])
|
|
180
180
|
expect(wrapper.find('.waveform-chart__tooltip').exists()).toBe(true)
|
|
181
|
-
expect(wrapper.get('.waveform-
|
|
181
|
+
expect(wrapper.get('.waveform-tooltip__series-label').text()).toContain('未配置炮号:')
|
|
182
182
|
const crosshairLines = wrapper.findAll('.waveform-chart__crosshair line')
|
|
183
183
|
expect(crosshairLines).toHaveLength(1)
|
|
184
184
|
expect(crosshairLines[0].attributes('x1')).toBe(crosshairLines[0].attributes('x2'))
|
|
@@ -303,7 +303,7 @@ describe('WaveformChart', () => {
|
|
|
303
303
|
flushAnimationFrames()
|
|
304
304
|
await flushPromises()
|
|
305
305
|
|
|
306
|
-
expect(wrapper.get('.waveform-
|
|
306
|
+
expect(wrapper.get('.waveform-tooltip__series-label').text()).toContain('未配置炮号:')
|
|
307
307
|
expect(wrapper.findAll('.waveform-chart__crosshair line')).toHaveLength(1)
|
|
308
308
|
expect(wrapper.get('.waveform-chart__line').element).toBe(pathBeforeHover)
|
|
309
309
|
expect(chartUpdate).not.toHaveBeenCalled()
|
package/src/core/data.test.ts
CHANGED
|
@@ -102,4 +102,26 @@ describe('waveform data normalization', () => {
|
|
|
102
102
|
'solid',
|
|
103
103
|
])
|
|
104
104
|
})
|
|
105
|
+
|
|
106
|
+
it('preserves trimmed shot numbers and omits blank values', () => {
|
|
107
|
+
const result = normalizeWaveformSeries({
|
|
108
|
+
kind: 'series',
|
|
109
|
+
series: [
|
|
110
|
+
{
|
|
111
|
+
id: 'with-shot',
|
|
112
|
+
shotNo: ' 13300 ',
|
|
113
|
+
name: '通道 A',
|
|
114
|
+
data: { kind: 'points', points: [{ x: 0, y: 1 }] },
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'without-shot',
|
|
118
|
+
shotNo: ' ',
|
|
119
|
+
name: '通道 B',
|
|
120
|
+
data: { kind: 'points', points: [{ x: 0, y: 2 }] },
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
expect(result.map((series) => series.shotNo)).toEqual(['13300', undefined])
|
|
126
|
+
})
|
|
105
127
|
})
|
package/src/core/data.ts
CHANGED
|
@@ -132,6 +132,7 @@ export function normalizeWaveformSeries(data: WaveformData): NormalizedWaveformS
|
|
|
132
132
|
|
|
133
133
|
return {
|
|
134
134
|
id: uniqueId,
|
|
135
|
+
shotNo: series.shotNo?.trim() || undefined,
|
|
135
136
|
trackId: series.trackId?.trim() || undefined,
|
|
136
137
|
name: series.name,
|
|
137
138
|
unit: series.unit,
|
|
@@ -13,6 +13,7 @@ describe('simulated waveform data', () => {
|
|
|
13
13
|
|
|
14
14
|
expect(first.series).toHaveLength(6)
|
|
15
15
|
expect(new Set(first.series.map((series) => series.id)).size).toBe(6)
|
|
16
|
+
expect(new Set(first.series.map((series) => series.shotNo))).toEqual(new Set(['13300']))
|
|
16
17
|
first.series.forEach((series) => {
|
|
17
18
|
expect(series.data.kind).toBe('points')
|
|
18
19
|
if (series.data.kind !== 'points') return
|
|
@@ -13,7 +13,7 @@ type ErrorGenerator = (
|
|
|
13
13
|
|
|
14
14
|
interface SimulatedSeriesDefinition extends Pick<
|
|
15
15
|
WaveformSeries,
|
|
16
|
-
'id' | 'name' | 'unit' | 'lineType' | 'pointType' | 'errorBar'
|
|
16
|
+
'id' | 'shotNo' | 'name' | 'unit' | 'lineType' | 'pointType' | 'errorBar'
|
|
17
17
|
> {
|
|
18
18
|
signal: SignalGenerator
|
|
19
19
|
errors?: ErrorGenerator
|
|
@@ -46,6 +46,7 @@ function createPoints(
|
|
|
46
46
|
const seriesDefinitions: SimulatedSeriesDefinition[] = [
|
|
47
47
|
{
|
|
48
48
|
id: 'simulated-sine',
|
|
49
|
+
shotNo: '13300',
|
|
49
50
|
name: '正弦基波',
|
|
50
51
|
unit: 'V',
|
|
51
52
|
lineType: 'none',
|
|
@@ -59,6 +60,7 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
|
|
|
59
60
|
},
|
|
60
61
|
{
|
|
61
62
|
id: 'simulated-harmonic',
|
|
63
|
+
shotNo: '13300',
|
|
62
64
|
name: '谐波扰动',
|
|
63
65
|
unit: 'V',
|
|
64
66
|
lineType: 'linear',
|
|
@@ -68,6 +70,7 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
|
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
id: 'simulated-damped',
|
|
73
|
+
shotNo: '13300',
|
|
71
74
|
name: '阻尼振荡',
|
|
72
75
|
unit: 'A',
|
|
73
76
|
lineType: 'linear',
|
|
@@ -79,6 +82,7 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
|
|
|
79
82
|
},
|
|
80
83
|
{
|
|
81
84
|
id: 'simulated-step',
|
|
85
|
+
shotNo: '13300',
|
|
82
86
|
name: '阶跃响应',
|
|
83
87
|
unit: 'V',
|
|
84
88
|
lineType: 'linear',
|
|
@@ -87,6 +91,7 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
|
|
|
87
91
|
},
|
|
88
92
|
{
|
|
89
93
|
id: 'simulated-pulse',
|
|
94
|
+
shotNo: '13300',
|
|
90
95
|
name: '脉冲响应',
|
|
91
96
|
unit: 'V',
|
|
92
97
|
lineType: 'linear',
|
|
@@ -95,6 +100,7 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
|
|
|
95
100
|
},
|
|
96
101
|
{
|
|
97
102
|
id: 'simulated-noise',
|
|
103
|
+
shotNo: '13300',
|
|
98
104
|
name: '带噪信号',
|
|
99
105
|
unit: 'A',
|
|
100
106
|
lineType: 'linear',
|
package/src/types/data.ts
CHANGED
|
@@ -47,6 +47,8 @@ export type SingleWaveformData =
|
|
|
47
47
|
*/
|
|
48
48
|
export interface WaveformSeries {
|
|
49
49
|
id?: string
|
|
50
|
+
/** 炮号,未提供时 Tooltip 显示“未配置炮号”。 */
|
|
51
|
+
shotNo?: string
|
|
50
52
|
/** 相同 trackId 的系列叠加在同一图框中;默认每个系列独占一个图框。 */
|
|
51
53
|
trackId?: string
|
|
52
54
|
name: string
|
|
@@ -74,6 +76,7 @@ export type WaveformData =
|
|
|
74
76
|
*/
|
|
75
77
|
export interface NormalizedWaveformSeries {
|
|
76
78
|
id: string
|
|
79
|
+
shotNo?: string
|
|
77
80
|
trackId?: string
|
|
78
81
|
name: string
|
|
79
82
|
unit?: string
|
|
@@ -19,6 +19,7 @@ const chartData: WaveformData = {
|
|
|
19
19
|
series: [
|
|
20
20
|
{
|
|
21
21
|
id: 'voltage',
|
|
22
|
+
shotNo: '13300',
|
|
22
23
|
name: '电压',
|
|
23
24
|
unit: 'V',
|
|
24
25
|
color: '#1677ff',
|
|
@@ -33,6 +34,7 @@ const chartData: WaveformData = {
|
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
id: 'current',
|
|
37
|
+
shotNo: '13300',
|
|
36
38
|
name: '电流',
|
|
37
39
|
unit: 'mA',
|
|
38
40
|
color: '#d4380d',
|