@gm-pc/vision 1.27.0 → 1.27.1-beta.0
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/package.json +2 -2
- package/src/chart/bar/components/table_chart.tsx +106 -106
- package/src/chart/bar/core/config.ts +259 -257
- package/src/chart/bar/core/index.ts +9 -9
- package/src/chart/bar/core/utils.ts +8 -8
- package/src/chart/bar/index.less +132 -132
- package/src/chart/bar/index.tsx +18 -18
- package/src/chart/bar/stories.tsx +420 -420
- package/src/chart/base/index.ts +139 -135
- package/src/chart/line/core/config.ts +211 -209
- package/src/chart/line/core/index.ts +9 -9
- package/src/chart/line/core/utils.ts +49 -49
- package/src/chart/line/index.tsx +12 -12
- package/src/chart/line/stories.tsx +234 -234
- package/src/chart/pie/core/config.ts +199 -199
- package/src/chart/pie/core/index.ts +9 -9
- package/src/chart/pie/index.tsx +12 -12
- package/src/chart/pie/stories.tsx +39 -39
- package/src/common/hooks/useChart.ts +40 -40
- package/src/common/utils/dom.ts +22 -22
- package/src/index.ts +11 -11
- package/src/theme/index.ts +8 -8
- package/src/theme/ocean/chart.ts +40 -40
- package/src/theme/ocean/index.ts +495 -495
- package/src/theme/sunset/chart.ts +40 -40
- package/src/theme/sunset/index.ts +495 -495
- package/src/theme/utils/create-style-by-sheet.ts +1303 -1303
- package/src/types/common.ts +41 -41
- package/src/types/theme.ts +552 -552
- package/tsconfig.json +3 -3
|
@@ -1,209 +1,211 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Instance } from '../../../types/common'
|
|
3
|
-
import { flatData, getPositionAndColor } from './utils'
|
|
4
|
-
import themes from '../../../theme'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Geek Blue 极客蓝 #5B8FF9
|
|
8
|
-
* Cyan 翡翠绿 #5AD8A6
|
|
9
|
-
* Grey 商务灰 #5D7092
|
|
10
|
-
* Sunrise Yellow 旭日黄 #F6BD16
|
|
11
|
-
* Dust Red 薄暮红 #E86452
|
|
12
|
-
* Daybreak Blue 破晓蓝 #6DC8EC
|
|
13
|
-
* Golden Purple 罗兰紫 #945FB9
|
|
14
|
-
* Sunset Orange 落日橘 #FF9845
|
|
15
|
-
* Dark Green 天水青 #1E9493
|
|
16
|
-
* Magenta 桃花粉 #FF99C3
|
|
17
|
-
*/
|
|
18
|
-
const colors = [
|
|
19
|
-
'#5B8FF9',
|
|
20
|
-
'#5AD8A6',
|
|
21
|
-
'#5D7092',
|
|
22
|
-
'#F6BD16',
|
|
23
|
-
'#E86452',
|
|
24
|
-
'#6DC8EC',
|
|
25
|
-
'#945FB9',
|
|
26
|
-
'#FF9845',
|
|
27
|
-
'#1E9493',
|
|
28
|
-
'#FF99C3',
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* - 几何标记 Geometry
|
|
33
|
-
* - 度量 Scale
|
|
34
|
-
* - 坐标系 Coordinate
|
|
35
|
-
* - 可视化组件 Component
|
|
36
|
-
* - 包括坐标轴 Axis,
|
|
37
|
-
* - 图例 Legend,
|
|
38
|
-
* - 提示信息 Tooltip,
|
|
39
|
-
* - 图形标记 Annotation,
|
|
40
|
-
* - 滑动条 Slider 等。
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
function geometry(params: Instance) {
|
|
44
|
-
const { chart, options } = params
|
|
45
|
-
|
|
46
|
-
const { position, color } = getPositionAndColor(params)
|
|
47
|
-
|
|
48
|
-
let geometry
|
|
49
|
-
if (color) {
|
|
50
|
-
geometry = chart.line().position(position).color(color)
|
|
51
|
-
} else {
|
|
52
|
-
geometry = chart.line().position(position)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return { ...params, geometry }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function scale(params: Instance) {
|
|
59
|
-
const { chart, options } = params
|
|
60
|
-
|
|
61
|
-
const { position, data, xFieldName, yFieldName, scale = {} } = options
|
|
62
|
-
if (_.isArray(position) || !position) {
|
|
63
|
-
if (data.length) {
|
|
64
|
-
const x = position ? position[0].split('*')[0] : xFieldName
|
|
65
|
-
const d = flatData(data, x, yFieldName)
|
|
66
|
-
chart.scale({
|
|
67
|
-
value: {
|
|
68
|
-
nice: true,
|
|
69
|
-
formatter: (value) => value,
|
|
70
|
-
},
|
|
71
|
-
...scale,
|
|
72
|
-
})
|
|
73
|
-
chart.scale({
|
|
74
|
-
[x]: {
|
|
75
|
-
nice: true,
|
|
76
|
-
formatter: (value) => value,
|
|
77
|
-
},
|
|
78
|
-
...scale,
|
|
79
|
-
})
|
|
80
|
-
chart.data(d)
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
const y = position.split('*')[1]
|
|
84
|
-
// TODO 通用配置 y轴nice: true
|
|
85
|
-
chart.scale({
|
|
86
|
-
[y]: {
|
|
87
|
-
nice: true,
|
|
88
|
-
},
|
|
89
|
-
...scale,
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return params
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function axis(params: Instance) {
|
|
97
|
-
const { chart, options } = params
|
|
98
|
-
const { position, color } = options
|
|
99
|
-
if (_.isArray(position)) {
|
|
100
|
-
chart.axis('value', {
|
|
101
|
-
label: {
|
|
102
|
-
formatter: (text) => text,
|
|
103
|
-
},
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
return params
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function annotation(params: Instance) {
|
|
110
|
-
const { chart, options } = params
|
|
111
|
-
const { data, annotation } = options
|
|
112
|
-
// 辅助线
|
|
113
|
-
if (annotation) {
|
|
114
|
-
const { text, value } = annotation
|
|
115
|
-
const yPosition = typeof value === 'string' ? value : value(data)
|
|
116
|
-
chart.annotation().line({
|
|
117
|
-
start: ['min', yPosition],
|
|
118
|
-
end: ['max', yPosition],
|
|
119
|
-
style: {
|
|
120
|
-
stroke: 'red',
|
|
121
|
-
lineWidth: 1,
|
|
122
|
-
lineDash: [3, 3],
|
|
123
|
-
},
|
|
124
|
-
text: {
|
|
125
|
-
position: 'right',
|
|
126
|
-
content: text,
|
|
127
|
-
},
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return params
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function tooltip(params: Instance) {
|
|
135
|
-
const { chart } = params
|
|
136
|
-
// tooltip样式
|
|
137
|
-
chart.tooltip({
|
|
138
|
-
showMarkers: true,
|
|
139
|
-
showCrosshairs: true,
|
|
140
|
-
shared: true,
|
|
141
|
-
domStyles: {
|
|
142
|
-
'g2-tooltip-marker': {
|
|
143
|
-
width: '10px',
|
|
144
|
-
height: '2px',
|
|
145
|
-
borderRadius: '0%',
|
|
146
|
-
display: 'inline-block',
|
|
147
|
-
marginBottom: '4px',
|
|
148
|
-
marginRight: '6px',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
geometry
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
.
|
|
196
|
-
.
|
|
197
|
-
.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import { Instance } from '../../../types/common'
|
|
3
|
+
import { flatData, getPositionAndColor } from './utils'
|
|
4
|
+
import themes from '../../../theme'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Geek Blue 极客蓝 #5B8FF9
|
|
8
|
+
* Cyan 翡翠绿 #5AD8A6
|
|
9
|
+
* Grey 商务灰 #5D7092
|
|
10
|
+
* Sunrise Yellow 旭日黄 #F6BD16
|
|
11
|
+
* Dust Red 薄暮红 #E86452
|
|
12
|
+
* Daybreak Blue 破晓蓝 #6DC8EC
|
|
13
|
+
* Golden Purple 罗兰紫 #945FB9
|
|
14
|
+
* Sunset Orange 落日橘 #FF9845
|
|
15
|
+
* Dark Green 天水青 #1E9493
|
|
16
|
+
* Magenta 桃花粉 #FF99C3
|
|
17
|
+
*/
|
|
18
|
+
const colors = [
|
|
19
|
+
'#5B8FF9',
|
|
20
|
+
'#5AD8A6',
|
|
21
|
+
'#5D7092',
|
|
22
|
+
'#F6BD16',
|
|
23
|
+
'#E86452',
|
|
24
|
+
'#6DC8EC',
|
|
25
|
+
'#945FB9',
|
|
26
|
+
'#FF9845',
|
|
27
|
+
'#1E9493',
|
|
28
|
+
'#FF99C3',
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* - 几何标记 Geometry
|
|
33
|
+
* - 度量 Scale
|
|
34
|
+
* - 坐标系 Coordinate
|
|
35
|
+
* - 可视化组件 Component
|
|
36
|
+
* - 包括坐标轴 Axis,
|
|
37
|
+
* - 图例 Legend,
|
|
38
|
+
* - 提示信息 Tooltip,
|
|
39
|
+
* - 图形标记 Annotation,
|
|
40
|
+
* - 滑动条 Slider 等。
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
function geometry(params: Instance) {
|
|
44
|
+
const { chart, options } = params
|
|
45
|
+
|
|
46
|
+
const { position, color } = getPositionAndColor(params)
|
|
47
|
+
|
|
48
|
+
let geometry
|
|
49
|
+
if (color) {
|
|
50
|
+
geometry = chart.line().position(position).color(color)
|
|
51
|
+
} else {
|
|
52
|
+
geometry = chart.line().position(position)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return { ...params, geometry }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function scale(params: Instance) {
|
|
59
|
+
const { chart, options } = params
|
|
60
|
+
|
|
61
|
+
const { position, data, xFieldName, yFieldName, scale = {} } = options
|
|
62
|
+
if (_.isArray(position) || !position) {
|
|
63
|
+
if (data.length) {
|
|
64
|
+
const x = position ? position[0].split('*')[0] : xFieldName
|
|
65
|
+
const d = flatData(data, x, yFieldName)
|
|
66
|
+
chart.scale({
|
|
67
|
+
value: {
|
|
68
|
+
nice: true,
|
|
69
|
+
formatter: (value) => value,
|
|
70
|
+
},
|
|
71
|
+
...scale,
|
|
72
|
+
})
|
|
73
|
+
chart.scale({
|
|
74
|
+
[x]: {
|
|
75
|
+
nice: true,
|
|
76
|
+
formatter: (value) => value,
|
|
77
|
+
},
|
|
78
|
+
...scale,
|
|
79
|
+
})
|
|
80
|
+
chart.data(d)
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
const y = position.split('*')[1]
|
|
84
|
+
// TODO 通用配置 y轴nice: true
|
|
85
|
+
chart.scale({
|
|
86
|
+
[y]: {
|
|
87
|
+
nice: true,
|
|
88
|
+
},
|
|
89
|
+
...scale,
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return params
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function axis(params: Instance) {
|
|
97
|
+
const { chart, options } = params
|
|
98
|
+
const { position, color } = options
|
|
99
|
+
if (_.isArray(position)) {
|
|
100
|
+
chart.axis('value', {
|
|
101
|
+
label: {
|
|
102
|
+
formatter: (text) => text,
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
return params
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function annotation(params: Instance) {
|
|
110
|
+
const { chart, options } = params
|
|
111
|
+
const { data, annotation } = options
|
|
112
|
+
// 辅助线
|
|
113
|
+
if (annotation) {
|
|
114
|
+
const { text, value } = annotation
|
|
115
|
+
const yPosition = typeof value === 'string' ? value : value(data)
|
|
116
|
+
chart.annotation().line({
|
|
117
|
+
start: ['min', yPosition],
|
|
118
|
+
end: ['max', yPosition],
|
|
119
|
+
style: {
|
|
120
|
+
stroke: 'red',
|
|
121
|
+
lineWidth: 1,
|
|
122
|
+
lineDash: [3, 3],
|
|
123
|
+
},
|
|
124
|
+
text: {
|
|
125
|
+
position: 'right',
|
|
126
|
+
content: text,
|
|
127
|
+
},
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return params
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function tooltip(params: Instance) {
|
|
135
|
+
const { chart } = params
|
|
136
|
+
// tooltip样式
|
|
137
|
+
chart.tooltip({
|
|
138
|
+
showMarkers: true,
|
|
139
|
+
showCrosshairs: true,
|
|
140
|
+
shared: true,
|
|
141
|
+
domStyles: {
|
|
142
|
+
'g2-tooltip-marker': {
|
|
143
|
+
width: '10px',
|
|
144
|
+
height: '2px',
|
|
145
|
+
borderRadius: '0%',
|
|
146
|
+
display: 'inline-block',
|
|
147
|
+
marginBottom: '4px',
|
|
148
|
+
marginRight: '6px',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
...(params?.options?.customTooltip || {}),
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
return params
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function legend(params: Instance) {
|
|
158
|
+
const { chart, options } = params
|
|
159
|
+
const { legend } = options
|
|
160
|
+
|
|
161
|
+
if (legend !== undefined) {
|
|
162
|
+
chart.legend(legend)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return params
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function theme(params: Instance) {
|
|
169
|
+
const { chart, options, geometry } = params
|
|
170
|
+
const { theme } = options
|
|
171
|
+
if (theme) {
|
|
172
|
+
const themeConfig = themes[theme as 'ocean'].chart
|
|
173
|
+
|
|
174
|
+
if (themeConfig) {
|
|
175
|
+
// ---------- geometry配置 ----------------
|
|
176
|
+
geometry!.shape(themeConfig.line.shape).style(themeConfig.line.style)
|
|
177
|
+
|
|
178
|
+
// ---------- tiptop配置 ----------------
|
|
179
|
+
chart.tooltip({
|
|
180
|
+
showMarkers: true,
|
|
181
|
+
showCrosshairs: true,
|
|
182
|
+
shared: true,
|
|
183
|
+
domStyles: {
|
|
184
|
+
'g2-tooltip-marker': {
|
|
185
|
+
display: 'none',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
...(options?.customTooltip || {}),
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
// ---------- area图 ----------------
|
|
192
|
+
if (themeConfig.line.area) {
|
|
193
|
+
const { position, color } = getPositionAndColor(params)
|
|
194
|
+
chart
|
|
195
|
+
.area()
|
|
196
|
+
.position(position)
|
|
197
|
+
.color(color)
|
|
198
|
+
.shape(themeConfig.line.area.shape)
|
|
199
|
+
.style({
|
|
200
|
+
fill: themeConfig.line.area.fill,
|
|
201
|
+
fillOpacity: 1,
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return params
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function processor(params: Instance) {
|
|
210
|
+
return _.flow(geometry, annotation, tooltip, scale, axis, legend, theme)(params)
|
|
211
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Base } from '../../base/index'
|
|
2
|
-
import { processor } from './config'
|
|
3
|
-
|
|
4
|
-
export default class Line extends Base {
|
|
5
|
-
name = 'line'
|
|
6
|
-
getProcessor() {
|
|
7
|
-
return processor
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
import { Base } from '../../base/index'
|
|
2
|
+
import { processor } from './config'
|
|
3
|
+
|
|
4
|
+
export default class Line extends Base {
|
|
5
|
+
name = 'line'
|
|
6
|
+
getProcessor() {
|
|
7
|
+
return processor
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { ChartOptions } from '../../../types/common'
|
|
3
|
-
|
|
4
|
-
export function flatData(data: any, x: string, position: string[] | string[][]) {
|
|
5
|
-
const result: { [key: string]: any }[] = []
|
|
6
|
-
_.forEach(data, (item) => {
|
|
7
|
-
_.forEach(position, (pos) => {
|
|
8
|
-
let y = ''
|
|
9
|
-
let type = y
|
|
10
|
-
if (_.isArray(pos)) {
|
|
11
|
-
type = pos[1]
|
|
12
|
-
y = pos[0]
|
|
13
|
-
} else {
|
|
14
|
-
y = (pos as string).split('*')[1]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
result.push({
|
|
18
|
-
[x]: item[x],
|
|
19
|
-
value: item[y],
|
|
20
|
-
type,
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
return result
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getPosition(xFieldName: string, yFieldName: string[][]) {
|
|
28
|
-
const position: string[] = []
|
|
29
|
-
yFieldName.map((field) => {
|
|
30
|
-
const name = field[0]
|
|
31
|
-
position.push(`${xFieldName}*${name}`)
|
|
32
|
-
})
|
|
33
|
-
return position
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function getPositionAndColor(params: ChartOptions) {
|
|
37
|
-
const { options } = params
|
|
38
|
-
const { position, color, xFieldName, theme } = options
|
|
39
|
-
const x = position ? position[0].split('*')[0] : xFieldName
|
|
40
|
-
|
|
41
|
-
if (_.isArray(position) || !position) {
|
|
42
|
-
return {
|
|
43
|
-
position: `${x}*value`,
|
|
44
|
-
color: 'type',
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
return { position, color }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import { ChartOptions } from '../../../types/common'
|
|
3
|
+
|
|
4
|
+
export function flatData(data: any, x: string, position: string[] | string[][]) {
|
|
5
|
+
const result: { [key: string]: any }[] = []
|
|
6
|
+
_.forEach(data, (item) => {
|
|
7
|
+
_.forEach(position, (pos) => {
|
|
8
|
+
let y = ''
|
|
9
|
+
let type = y
|
|
10
|
+
if (_.isArray(pos)) {
|
|
11
|
+
type = pos[1]
|
|
12
|
+
y = pos[0]
|
|
13
|
+
} else {
|
|
14
|
+
y = (pos as string).split('*')[1]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
result.push({
|
|
18
|
+
[x]: item[x],
|
|
19
|
+
value: item[y],
|
|
20
|
+
type,
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
return result
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getPosition(xFieldName: string, yFieldName: string[][]) {
|
|
28
|
+
const position: string[] = []
|
|
29
|
+
yFieldName.map((field) => {
|
|
30
|
+
const name = field[0]
|
|
31
|
+
position.push(`${xFieldName}*${name}`)
|
|
32
|
+
})
|
|
33
|
+
return position
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function getPositionAndColor(params: ChartOptions) {
|
|
37
|
+
const { options } = params
|
|
38
|
+
const { position, color, xFieldName, theme } = options
|
|
39
|
+
const x = position ? position[0].split('*')[0] : xFieldName
|
|
40
|
+
|
|
41
|
+
if (_.isArray(position) || !position) {
|
|
42
|
+
return {
|
|
43
|
+
position: `${x}*value`,
|
|
44
|
+
color: 'type',
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
return { position, color }
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/chart/line/index.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, { FC, forwardRef, useRef, useEffect } from 'react'
|
|
2
|
-
import _Line from './core'
|
|
3
|
-
import useChart from '../../common/hooks/useChart'
|
|
4
|
-
import { ChartProps, ChartOptions } from '../../types/common'
|
|
5
|
-
|
|
6
|
-
const Line: FC<ChartProps> = forwardRef((props, ref) => {
|
|
7
|
-
const { container } = useChart(_Line, props)
|
|
8
|
-
|
|
9
|
-
return <div ref={container} />
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
export { Line }
|
|
1
|
+
import React, { FC, forwardRef, useRef, useEffect } from 'react'
|
|
2
|
+
import _Line from './core'
|
|
3
|
+
import useChart from '../../common/hooks/useChart'
|
|
4
|
+
import { ChartProps, ChartOptions } from '../../types/common'
|
|
5
|
+
|
|
6
|
+
const Line: FC<ChartProps> = forwardRef((props, ref) => {
|
|
7
|
+
const { container } = useChart(_Line, props)
|
|
8
|
+
|
|
9
|
+
return <div ref={container} />
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export { Line }
|