diff --git a/package.json b/package.json
index 318e868..07fe3ac 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "waveform-analysis",
- "version": "0.1.18",
+ "version": "0.1.19",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/types/index.d.ts",
diff --git a/src/components/interaction/WaveformTooltip.test.ts b/src/components/interaction/WaveformTooltip.test.ts
index 4ff12f5..07e81d5 100644
--- a/src/components/interaction/WaveformTooltip.test.ts
+++ b/src/components/interaction/WaveformTooltip.test.ts
@@ -66,6 +66,31 @@ describe('WaveformTooltip', () => {
expect(wrapper.get('.waveform-tooltip__series small').text()).toBe('(+2 / -1)')
})
+ it('keeps a formatted value and its unit in one value container', () => {
+ const hoveredPoint = { x: 1, y: -1405.4932 }
+ const wrapper = mount(WaveformTooltip, {
+ props: {
+ visible: true,
+ position: { x: 10, y: 10 },
+ timeUnit: 'ms',
+ hoveredPoint,
+ seriesPoints: [
+ {
+ trackIndex: 0,
+ name: 'ENG8KJXAc(10001)',
+ color: '#ffb43b',
+ unit: 'A',
+ point: hoveredPoint,
+ },
+ ],
+ containerWidth: 400,
+ containerHeight: 300,
+ },
+ })
+
+ expect(wrapper.get('.waveform-tooltip__value').text()).toBe('-1,405.4932 A')
+ })
+
it('omits the error label when both resolved errors are zero', () => {
const point = { x: 1, y: 12 }
const wrapper = mount(WaveformTooltip, {
diff --git a/src/components/interaction/WaveformTooltip.vue b/src/components/interaction/WaveformTooltip.vue
index 50062f0..79fc3d9 100644
--- a/src/components/interaction/WaveformTooltip.vue
+++ b/src/components/interaction/WaveformTooltip.vue
@@ -77,7 +77,7 @@ function formatError(point: WaveformPoint): string | null {
>
{{ seriesPoint.name }}:
-
+
{{ formatTooltipNumber(seriesPoint.point.y)
}}{{ seriesPoint.unit ? ` ${seriesPoint.unit}` : '' }}
{{ formatError(seriesPoint.point) }}
@@ -116,7 +116,7 @@ function formatError(point: WaveformPoint): string | null {
.waveform-tooltip__series {
display: grid;
- grid-template-columns: 8px auto minmax(0, 1fr);
+ grid-template-columns: 8px minmax(0, 1fr) auto;
gap: 6px;
align-items: center;
}
@@ -134,6 +134,10 @@ function formatError(point: WaveformPoint): string | null {
white-space: nowrap;
}
+.waveform-tooltip__value {
+ white-space: nowrap;
+}
+
.waveform-tooltip__series small {
color: #667085;
white-space: nowrap;