waveform-analysis 0.1.64 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +40 -25
- package/dist/style.css +1 -1
- package/dist/types/components/core/constants.d.ts +1 -1
- package/dist/types/components/core/trackLayoutBuilder.d.ts +1 -0
- package/dist/types/components/core/yAxisConstants.d.ts +1 -1
- package/dist/types/types/chart.d.ts +4 -0
- package/package.json +1 -1
- package/src/App.vue +2 -2
- package/src/components/WaveformChart.css +4 -0
- package/src/components/WaveformChart.vue +1 -1
- package/src/components/core/constants.ts +3 -3
- package/src/components/core/layout.ts +1 -1
- package/src/components/core/trackLayoutBuilder.ts +42 -1
- package/src/components/core/useWaveformLayout.ts +2 -1
- package/src/components/core/useWaveformPresentation.ts +1 -1
- package/src/components/core/yAxisConstants.ts +1 -1
- package/src/components/rendering/WaveformLegend.vue +1 -1
- package/src/components/rendering/WaveformSeriesLayer.vue +1 -1
- package/src/components/rendering/WaveformTrack.css +5 -2
- package/src/components/rendering/WaveformTrack.vue +7 -1
- package/src/components/rendering/WaveformTrackAxes.vue +8 -2
- package/src/types/chart.ts +4 -0
|
@@ -2,7 +2,7 @@ export const Y_AXIS_CHARACTER_WIDTH = 7
|
|
|
2
2
|
export const Y_AXIS_TICK_PADDING = 7
|
|
3
3
|
export const Y_AXIS_OUTER_PADDING = 4
|
|
4
4
|
export const Y_AXIS_LABEL_GAP = 0
|
|
5
|
-
export const Y_AXIS_LABEL_BAND_WIDTH =
|
|
5
|
+
export const Y_AXIS_LABEL_BAND_WIDTH = 20
|
|
6
6
|
export const Y_AXIS_RIGHT_LABEL_OFFSET = 10
|
|
7
7
|
|
|
8
8
|
export function resolveYAxisSides(axisCount: number): Array<'left' | 'right'> {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.waveform-track__y-axis-label {
|
|
13
|
-
font-size:
|
|
14
|
-
font-weight:
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 600;
|
|
15
15
|
pointer-events: none;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
.waveform-track__axis-endpoint {
|
|
84
84
|
fill: #667085;
|
|
85
85
|
font-size: 11px;
|
|
86
|
+
font-weight: 700;
|
|
86
87
|
pointer-events: none;
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
fill: #666;
|
|
91
92
|
font-family: sans-serif;
|
|
92
93
|
font-size: 10px;
|
|
94
|
+
font-weight: 700;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
.waveform-track__axis path,
|
|
@@ -100,4 +102,5 @@
|
|
|
100
102
|
.waveform-track__axis text {
|
|
101
103
|
fill: #667085;
|
|
102
104
|
font-size: 11px;
|
|
105
|
+
font-weight: 700;
|
|
103
106
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
|
|
4
|
+
import { ZERO_LINE_DEFAULTS } from '../core/constants'
|
|
4
5
|
import type { WaveformAxesOptions, WaveformFrameStyle, WaveformZeroLineOptions } from '../../types'
|
|
5
6
|
import type { TrackLayout } from '../core/types'
|
|
6
7
|
import type { WaveformDisplayMode, WaveformInteractionMode } from '../data/types'
|
|
@@ -41,7 +42,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
41
42
|
interactionMode: 'zoom',
|
|
42
43
|
interactive: true,
|
|
43
44
|
cleanView: false,
|
|
44
|
-
zeroLine: () => ({
|
|
45
|
+
zeroLine: () => ({
|
|
46
|
+
visible: true,
|
|
47
|
+
color: ZERO_LINE_DEFAULTS.COLOR,
|
|
48
|
+
width: ZERO_LINE_DEFAULTS.WIDTH,
|
|
49
|
+
dash: ZERO_LINE_DEFAULTS.DASH,
|
|
50
|
+
}),
|
|
45
51
|
})
|
|
46
52
|
const emit = defineEmits<Emits>()
|
|
47
53
|
|
|
@@ -61,6 +61,12 @@ function renderAxes() {
|
|
|
61
61
|
|
|
62
62
|
const selection = select(element)
|
|
63
63
|
selection.call(yAxis)
|
|
64
|
+
const lowestTick = Math.min(...axis.tickValues)
|
|
65
|
+
selection
|
|
66
|
+
.selectAll<SVGTextElement, number>('.tick text')
|
|
67
|
+
.attr('y', null)
|
|
68
|
+
.attr('dy', (value) => (value === lowestTick ? '0' : '0.32em'))
|
|
69
|
+
.attr('dominant-baseline', (value) => (value === lowestTick ? 'text-after-edge' : null))
|
|
64
70
|
selection
|
|
65
71
|
.selectAll('path.domain')
|
|
66
72
|
.attr('display', props.axes?.y?.lineVisible === false ? 'none' : null)
|
|
@@ -175,7 +181,7 @@ watch(
|
|
|
175
181
|
>
|
|
176
182
|
<rect
|
|
177
183
|
class="waveform-track__y-axis-label-bg waveform-chart__y-axis-label-bg"
|
|
178
|
-
:x="track.
|
|
184
|
+
:x="track.yAxes[0].labelX - Y_AXIS_LABEL_BAND_WIDTH / 2"
|
|
179
185
|
:y="track.height / 2 - 40"
|
|
180
186
|
:width="Y_AXIS_LABEL_BAND_WIDTH"
|
|
181
187
|
height="80"
|
|
@@ -184,7 +190,7 @@ watch(
|
|
|
184
190
|
<text
|
|
185
191
|
class="waveform-track__y-axis-label waveform-chart__y-axis-label"
|
|
186
192
|
:fill="track.series?.color"
|
|
187
|
-
:transform="`translate(${track.
|
|
193
|
+
:transform="`translate(${track.yAxes[0].labelX}, ${track.height / 2}) rotate(-90)`"
|
|
188
194
|
text-anchor="middle"
|
|
189
195
|
dominant-baseline="central"
|
|
190
196
|
>
|
package/src/types/chart.ts
CHANGED
|
@@ -258,8 +258,12 @@ export interface WaveformAxesOptions {
|
|
|
258
258
|
|
|
259
259
|
/** Styling and visibility options for the horizontal zero-value reference line. */
|
|
260
260
|
export interface WaveformZeroLineOptions {
|
|
261
|
+
/** Defaults to true. Set false to hide the reference line. */
|
|
261
262
|
visible?: boolean
|
|
263
|
+
/** Defaults to red (#ff0000). */
|
|
262
264
|
color?: string
|
|
265
|
+
/** Positive stroke width in pixels. Defaults to 1. */
|
|
263
266
|
width?: number
|
|
267
|
+
/** SVG stroke-dasharray. Defaults to '6 4'; use '' for a solid line. */
|
|
264
268
|
dash?: string
|
|
265
269
|
}
|