diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 810146281..6802f0713 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - node_version: ['16', '18'] + node_version: ['18'] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/packages/f2/src/index.ts b/packages/f2/src/index.ts index 2b7897bf7..15a68fa4b 100644 --- a/packages/f2/src/index.ts +++ b/packages/f2/src/index.ts @@ -4,6 +4,5 @@ export * from '@antv/f-engine'; export { default as Chart, ChartProps } from './chart'; export { Scale, ScaleConfig } from './deps/f2-scale/src'; export * from './components'; - //@ts-ignore export default { version: VERSION }; diff --git a/packages/f2/src/theme.ts b/packages/f2/src/theme.ts index f4a70e844..e683bca96 100644 --- a/packages/f2/src/theme.ts +++ b/packages/f2/src/theme.ts @@ -117,6 +117,15 @@ export default { smooth: { smooth: true, }, + 'step-start': { + step: 'start', + }, + 'step-middle': { + step: 'middle', + }, + 'step-end': { + step: 'end', + }, dash: { lineDash: ['8px', '8px'], }, diff --git "a/packages/f2/test/components/line/__image_snapshots__/line-test-tsx-\346\212\230\347\272\277\345\233\276-\345\237\272\347\241\200\346\212\230\347\272\277\345\233\276-\351\230\266\346\242\257\345\233\276-1-snap.png" "b/packages/f2/test/components/line/__image_snapshots__/line-test-tsx-\346\212\230\347\272\277\345\233\276-\345\237\272\347\241\200\346\212\230\347\272\277\345\233\276-\351\230\266\346\242\257\345\233\276-1-snap.png" new file mode 100644 index 000000000..fb88b7e26 Binary files /dev/null and "b/packages/f2/test/components/line/__image_snapshots__/line-test-tsx-\346\212\230\347\272\277\345\233\276-\345\237\272\347\241\200\346\212\230\347\272\277\345\233\276-\351\230\266\346\242\257\345\233\276-1-snap.png" differ diff --git a/packages/f2/test/components/line/line.test.tsx b/packages/f2/test/components/line/line.test.tsx index 7bd289ed1..2009f189c 100644 --- a/packages/f2/test/components/line/line.test.tsx +++ b/packages/f2/test/components/line/line.test.tsx @@ -1,4 +1,3 @@ -import { Rect } from '../../../src/coord'; import { jsx, Component, Canvas, Chart, Line, Point, Axis, Legend } from '../../../src'; import { createContext, delay } from '../../util'; const data1 = [ @@ -384,44 +383,6 @@ describe('折线图', () => { }); it('曲线', async () => { - const data = [ - { - time: '2016-08-08 00:00:00', - tem: 10, - }, - { - time: '2016-08-08 00:10:00', - tem: 22, - }, - { - time: '2016-08-08 00:30:00', - tem: 20, - }, - { - time: '2016-08-09 00:35:00', - tem: 26, - }, - { - time: '2016-08-09 01:00:00', - tem: 20, - }, - { - time: '2016-08-09 01:20:00', - tem: 26, - }, - { - time: '2016-08-10 01:40:00', - tem: 28, - }, - { - time: '2016-08-10 02:00:00', - tem: 20, - }, - { - time: '2016-08-10 02:20:00', - tem: 18, - }, - ]; const context = createContext('曲线'); const chartRef = { current: null }; const lineRef = { current: null }; @@ -461,6 +422,79 @@ describe('折线图', () => { await delay(1000); expect(context).toMatchImageSnapshot(); }); + + it('阶梯图', async () => { + const context = createContext('阶梯图', { + width: '380px', + }); + const data = []; + [ + { + time: '2016-08-01', + tem: 15, + type: 'start', + }, + { + time: '2016-08-02', + tem: 22, + type: 'start', + }, + { + time: '2016-08-03', + tem: 15, + type: 'start', + }, + { + time: '2016-08-04', + tem: 26, + type: 'start', + }, + { + time: '2016-08-05', + tem: 20, + type: 'start', + }, + { + time: '2016-08-06', + tem: 26, + type: 'start', + }, + ].map((d) => { + data.push(d); + data.push({ ...d, tem: d.tem + 15, type: 'middle' }); + data.push({ ...d, tem: d.tem + 30, type: 'end' }); + }); + + const { type, props } = ( + + + + + + + + ); + const canvas = new Canvas(props); + await canvas.render(); + await delay(500); + expect(context).toMatchImageSnapshot(); + }); }); describe('对比折线图', () => {