3328350766
6 天以前 761eb03d6b3bebd0b197179564c84d89d3d12a0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
 
// 配置版本号
const version = '2023092201'
// 分类
const category = '散点图'
// 标题
const title = '散点图'
// 类别, new Line()
const chartType = 'Scatter'
// 用于标识,唯一,和文件夹名称一致
const name = 'SanDianTu'
 
// 右侧配置项
const setting = [
  {
    label: '维度',
    type: 'select', // 设置组件类型
    field: 'size', // 字段
    optionField: 'size', // 对应options中的字段
    // 是否多选
    multiple: false,
    value: '',
    tabName: 'data'
  },
  {
    label: '指标',
    type: 'select', // 设置组件类型
    field: 'sets', // 字段
    optionField: 'sets', // 对应options中的字段
    // 是否多选
    multiple: false,
    value: '',
    tabName: 'data'
  },
  {
    label: '颜色',
    type: 'select', // 设置组件类型
    field: 'colorField', // 字段
    optionField: 'colorField', // 对应options中的字段
    // 是否多选
    multiple: false,
    value: '',
    tabName: 'data'
  },
  {
    label: '颜色配置',
    // 设置组件类型
    type: 'colorSelect',
    // 字段
    field: 'color',
    // 对应options中的字段
    optionField: 'color',
    value: ['#6b74e4', '#4391f4', '#38bbe5', '#69d6fd', '#36c6a0'],
    tabName: 'custom',
    groupName: 'graph'
  },
  {
    label: '数据点形状',
    type: 'select', // 设置组件类型
    field: 'shape', // 字段
    optionField: 'shape', // 对应options中的字段
    // 是否多选
    multiple: false,
    value: 'circle',
    tabName: 'custom',
    options: [
      {
        label: '无',
        value: false
      },
      {
        label: '空心圆',
        value: 'hollow-circle'
      },
      {
        label: '圆形',
        value: 'circle'
      },
      {
        label: '正方形',
        value: 'square'
      },
      {
        label: '菱形',
        value: 'diamond'
      },
      {
        label: '三角形',
        value: 'triangle'
      },
      {
        label: '六边形',
        value: 'hexagon'
      },
      {
        label: '菱形交叉',
        value: 'bowtie'
      },
      {
        label: '十字形',
        value: 'cross'
      },
      {
        label: 'I形',
        value: 'tick'
      },
      {
        label: '加号',
        value: 'plus'
      },
      {
        label: '连字号',
        value: 'hyphen'
      }
    ],
    groupName: 'graph'
  },
  {
    label: '透明度',
    type: 'inputNumber', // 设置组件类型
    field: 'pointStyle_fillOpacity', // 字段
    optionField: 'pointStyle.fillOpacity', // 对应options中的字段
    value: 0.8,
    tabName: 'custom',
    groupName: 'graph'
  },
  {
    label: '图表边距',
    type: 'padding', // 设置组件类型
    field: 'appendPadding', //
    optionField: 'appendPadding', // 对应options中的字段
    value: [20, 20, 20, 20],
    tabName: 'custom',
    groupName: 'padding'
  }
]
 
// 模拟数据
const data = [
  {
    Title: 'Guardians of the Galaxy',
    Genre: 'Action',
    'Revenue (Millions)': 333.13,
    Rating: 8.1
  },
  {
    Title: 'Prometheus',
    Genre: 'Adventure',
    'Revenue (Millions)': 126.46,
    Rating: 7
  },
  {
    Title: 'Split',
    Genre: 'Horror',
    'Revenue (Millions)': 138.12,
    Rating: 7.3
  },
  {
    Title: 'Sing',
    Genre: 'Animation',
    'Revenue (Millions)': 270.32,
    Rating: 7.2
  },
  {
    Title: 'Suicide Squad',
    Genre: 'Action',
    'Revenue (Millions)': 325.02,
    Rating: 6.2
  },
  {
    Title: 'The Great Wall',
    Genre: 'Action',
    'Revenue (Millions)': 45.13,
    Rating: 6.1
  },
  {
    Title: 'La La Land',
    Genre: 'Comedy',
    'Revenue (Millions)': 151.06,
    Rating: 8.3
  },
  {
    Title: 'Mindhorn',
    Genre: 'Comedy',
    'Revenue (Millions)': null,
    Rating: 6.4
  },
  {
    Title: 'The Lost City of Z',
    Genre: 'Action',
    'Revenue (Millions)': 8.01,
    Rating: 7.1
  },
  {
    Title: 'Passengers',
    Genre: 'Adventure',
    'Revenue (Millions)': 100.01,
    Rating: 7
  },
  {
    Title: 'Fantastic Beasts and Where to Find Them',
    Genre: 'Adventure',
    'Revenue (Millions)': 234.02,
    Rating: 7.5
  },
  {
    Title: 'Hidden Figures',
    Genre: 'Other',
    'Revenue (Millions)': 169.27,
    Rating: 7.8
  },
  {
    Title: 'Rogue One',
    Genre: 'Action',
    'Revenue (Millions)': 532.17,
    Rating: 7.9
  },
  {
    Title: 'Moana',
    Genre: 'Animation',
    'Revenue (Millions)': 248.75,
    Rating: 7.7
  },
  {
    Title: 'Colossal',
    Genre: 'Action',
    'Revenue (Millions)': 2.87,
    Rating: 6.4
  },
  {
    Title: 'The Secret Life of Pets',
    Genre: 'Animation',
    'Revenue (Millions)': 368.31,
    Rating: 6.6
  },
  {
    Title: 'Hacksaw Ridge',
    Genre: 'Other',
    'Revenue (Millions)': 67.12,
    Rating: 8.2
  },
  {
    Title: 'Jason Bourne',
    Genre: 'Action',
    'Revenue (Millions)': 162.16,
    Rating: 6.7
  },
  {
    Title: 'Lion',
    Genre: 'Other',
    'Revenue (Millions)': 51.69,
    Rating: 8.1
  },
  {
    Title: 'Gold',
    Genre: 'Adventure',
    'Revenue (Millions)': 7.22,
    Rating: 6.7
  }
]
// 配置处理脚本
const optionHandler = ''
 
// 数据处理脚本
const dataHandler = ''
 
// 图表配置 new Line('domName', option)
const option = {
  appendPadding: 10,
  data,
  xField: 'Revenue (Millions)',
  yField: 'Rating',
  colorField: 'Genre',
  shape: 'diamond',
  pointStyle: {
    fillOpacity: 0.8
  },
  color: ['#6b74e4', '#4391f4', '#38bbe5', '#69d6fd', '#36c6a0'],
  size: 4,
  yAxis: {
    nice: true,
    line: {
      style: {
        stroke: '#aaa'
      }
    }
  },
  xAxis: {
    min: -100,
    grid: {
      line: {
        style: {
          stroke: '#eee'
        }
      }
    },
    line: {
      style: {
        stroke: '#aaa'
      }
    }
  }
}
export default {
  version,
  category,
  title,
  chartType,
  name,
  option,
  setting,
  optionHandler,
  dataHandler
}