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.
@@ -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 = 12
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'> {
@@ -93,7 +93,7 @@ function toggleSeries(seriesId: string) {
93
93
  :d="waveformLegendLinePath(item.lineType) ?? undefined"
94
94
  :stroke="item.color"
95
95
  :stroke-dasharray="waveformLineDasharray(item.lineStyle)"
96
- stroke-width="2.5"
96
+ stroke-width="1"
97
97
  fill="none"
98
98
  />
99
99
  <path
@@ -103,7 +103,7 @@ const renderedSeriesPaths = computed<RenderedSeriesPath[]>(() =>
103
103
  <style scoped>
104
104
  .waveform-track__line {
105
105
  fill: none;
106
- stroke-width: 2.5;
106
+ stroke-width: 1;
107
107
  stroke-linejoin: round;
108
108
  stroke-linecap: round;
109
109
  }
@@ -10,8 +10,8 @@
10
10
  }
11
11
 
12
12
  .waveform-track__y-axis-label {
13
- font-size: 12px;
14
- font-weight: 500;
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: () => ({ visible: false, color: '#98a2b3', width: 1, dash: '6 4' }),
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.yAxisLabelX - Y_AXIS_LABEL_BAND_WIDTH / 2"
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.yAxisLabelX}, ${track.height / 2}) rotate(-90)`"
193
+ :transform="`translate(${track.yAxes[0].labelX}, ${track.height / 2}) rotate(-90)`"
188
194
  text-anchor="middle"
189
195
  dominant-baseline="central"
190
196
  >
@@ -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
  }