diff --git a/packages/f2/test/components/line/line.test.tsx b/packages/f2/test/components/line/line.test.tsx index 2009f189c..fa66e8c6d 100644 --- a/packages/f2/test/components/line/line.test.tsx +++ b/packages/f2/test/components/line/line.test.tsx @@ -383,6 +383,44 @@ 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 }; diff --git a/site/.dumi/tsconfig.json b/site/.dumi/tsconfig.json new file mode 100644 index 000000000..79711a82b --- /dev/null +++ b/site/.dumi/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "**/*" + ] +} \ No newline at end of file diff --git a/site/examples/line/line/demo/meta.json b/site/examples/line/line/demo/meta.json index fdf41b5d2..ab4655a52 100644 --- a/site/examples/line/line/demo/meta.json +++ b/site/examples/line/line/demo/meta.json @@ -19,6 +19,11 @@ "title": "曲线", "screenshot": "https://gw.alipayobjects.com/mdn/rms_4f0ff1/afts/img/A*LU4qRJrOSQkAAAAAAAAAAABkARQnAQ" }, + { + "filename": "step.jsx", + "title": "阶梯", + "screenshot": "https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/nnBatWjRpi6HtWmjwdPd4/line_test_tsx_zhexiantu_jichuzhexiantu_jietitu_1_snap.png" + }, { "filename": "pan.jsx", "title": "折线图平移", diff --git a/site/examples/line/line/demo/step.jsx b/site/examples/line/line/demo/step.jsx new file mode 100644 index 000000000..f3f72a9e9 --- /dev/null +++ b/site/examples/line/line/demo/step.jsx @@ -0,0 +1,70 @@ +import { Axis, Canvas, Chart, Line } from '@antv/f2'; + +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 context = document.getElementById('container').getContext('2d'); +const { props } = ( + + + + + + + +); + +const canvas = new Canvas(props); +canvas.render();