feat(chart): add multi-axis overlay controls

This commit is contained in:
李启源
2026-07-20 15:35:19 +08:00
parent 0cab86f7b6
commit c9e4dae25f
44 changed files with 1882 additions and 523 deletions

View File

@@ -14,6 +14,7 @@ describe('App workspace layout', () => {
const frameControls = panel.get('.frame-style-controls')
expect(panel.find('h1').exists()).toBe(false)
expect(panel.find('[aria-label="波形展示方式"]').exists()).toBe(true)
expect(panel.find('[aria-label="波形叠加方式"]').exists()).toBe(true)
expect(panel.find('[aria-label="波形网格尺寸"]').exists()).toBe(true)
expect(frameControls.findAllComponents(ColorPicker)).toHaveLength(2)
expect(frameControls.text()).toContain('边框颜色')
@@ -45,6 +46,43 @@ describe('App workspace layout', () => {
wrapper.unmount()
})
it('switches overlaid tracks between single-axis and multi-axis rendering', async () => {
const wrapper = mount(App)
await flushPromises()
const overlayControl = wrapper.get('[aria-label="波形叠加方式"]')
expect(wrapper.get('.waveform-chart').attributes('data-overlay-mode')).toBe('single-axis')
expect(overlayControl.text()).toContain('单值轴')
expect(overlayControl.text()).toContain('多值轴')
await overlayControl.findAll('input[type="radio"]')[1]?.setValue(true)
await flushPromises()
expect(wrapper.get('.waveform-chart').attributes('data-overlay-mode')).toBe('multi-axis')
expect(wrapper.findAll('.waveform-chart__axis--y').length).toBeGreaterThan(1)
wrapper.unmount()
})
it('renders three additional sample series in the first frame', async () => {
const wrapper = mount(App)
await flushPromises()
const firstFrameLines = wrapper
.get('.waveform-chart__track[data-track-index="0"]')
.findAll('.waveform-chart__line')
expect(firstFrameLines.map((line) => line.attributes('data-series-name'))).toEqual([
'BT2_2M',
'TEST_CH_1',
'TEST_CH_3',
'TEST_CH_4',
'TEST_CH_5',
])
wrapper.unmount()
})
it('updates title content, text styles, and visibility', async () => {
const wrapper = mount(App)
await flushPromises()