st-comp 0.0.20 → 0.0.21
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/lib/bundle.js +129785 -10780
- package/lib/bundle.umd.cjs +82 -11
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/HeatMap/index.ts +8 -0
- package/packages/HeatMap/index.vue +9 -0
- package/packages/Kline/index.vue +23 -35
- package/packages/Kline/option.ts +90 -94
- package/packages/Kline/type.d.ts +1 -0
- package/packages/Map/China.json +1 -0
- package/packages/Map/index.ts +8 -0
- package/packages/Map/index.vue +110 -0
- package/packages/Pie/index.ts +8 -0
- package/packages/Pie/index.vue +107 -0
- package/packages/index.ts +6 -0
- package/src/pages/HeatMap/index.vue +286 -0
- package/src/pages/Kline/components/SingleCycleSingleVariety.vue +8 -0
- package/src/pages/Map/index.vue +50 -0
- package/src/pages/Pie/index.vue +19 -0
- package/src/router/routes.ts +15 -0
- package/vitePlugins/createExportFile.ts +3 -0
package/packages/Kline/option.ts
CHANGED
|
@@ -144,19 +144,13 @@ export const getOption = async (
|
|
|
144
144
|
},
|
|
145
145
|
min: (value: any) => {
|
|
146
146
|
const { min, max } = value
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
return Math.floor(minValue)
|
|
150
|
-
}
|
|
151
|
-
return minValue
|
|
147
|
+
const interval = Math.abs((max - min) / 10)
|
|
148
|
+
return min - interval
|
|
152
149
|
},
|
|
153
150
|
max: (value: any) => {
|
|
154
151
|
const { min, max } = value
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
return Math.ceil(maxValue as number)
|
|
158
|
-
}
|
|
159
|
-
return maxValue
|
|
152
|
+
const interval = Math.abs((max - min) / 10)
|
|
153
|
+
return max + interval
|
|
160
154
|
},
|
|
161
155
|
axisLine: {
|
|
162
156
|
show: true,
|
|
@@ -222,93 +216,95 @@ export const getOption = async (
|
|
|
222
216
|
*/
|
|
223
217
|
export const getLineOption = (data: LineDataType, config: InConfig, echartsInstance: EChartsType) => {
|
|
224
218
|
const { gridLeft, gridRight, warningConfig, positionConfig, conditionConfig } = config
|
|
225
|
-
const [minValue, maxValue] = (echartsInstance as any).getModel().getComponent('yAxis').axis.scale._extent
|
|
226
|
-
|
|
227
|
-
// -----数据初始化----
|
|
228
219
|
let elements: any = []
|
|
229
|
-
let warningData: WarningDataItem[] = []
|
|
230
|
-
let warningEvent: GraphicEvent = {}
|
|
231
|
-
let positionData: PositionDataItem[] = []
|
|
232
|
-
let positionEvent: GraphicEvent = {}
|
|
233
|
-
let conditionData: ConditionDataItem[] = []
|
|
234
|
-
let conditionEvent: GraphicEvent = {}
|
|
235
|
-
data.forEach(({ key, data, ...events }) => {
|
|
236
|
-
if (key === 'warning') {
|
|
237
|
-
warningData = data as WarningDataItem[]
|
|
238
|
-
warningEvent = events
|
|
239
|
-
} else if (key === 'position') {
|
|
240
|
-
positionData = data as PositionDataItem[]
|
|
241
|
-
positionEvent = events
|
|
242
|
-
} else if (key === 'condition') {
|
|
243
|
-
conditionData = data as ConditionDataItem[]
|
|
244
|
-
conditionEvent = events
|
|
245
|
-
}
|
|
246
|
-
})
|
|
247
220
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
// -----处理持仓线-----
|
|
269
|
-
if (positionData.length > 0) {
|
|
270
|
-
elements = positionData.reduce((res, item: PositionDataItem) => {
|
|
271
|
-
const { value, text, info, config } = item
|
|
272
|
-
// 数值超出图表范围的不绘制, 直接return
|
|
273
|
-
if (value > maxValue || value < minValue) {
|
|
274
|
-
// 当前数值超出图表范围,不绘制
|
|
275
|
-
return res
|
|
221
|
+
if ( (echartsInstance as any)?.getModel()?.getComponent ) {
|
|
222
|
+
const [minValue, maxValue] = (echartsInstance as any).getModel().getComponent('yAxis').axis.scale._extent
|
|
223
|
+
// -----数据初始化----
|
|
224
|
+
let warningData: WarningDataItem[] = []
|
|
225
|
+
let warningEvent: GraphicEvent = {}
|
|
226
|
+
let positionData: PositionDataItem[] = []
|
|
227
|
+
let positionEvent: GraphicEvent = {}
|
|
228
|
+
let conditionData: ConditionDataItem[] = []
|
|
229
|
+
let conditionEvent: GraphicEvent = {}
|
|
230
|
+
data.forEach(({ key, data, ...events }) => {
|
|
231
|
+
if (key === 'warning') {
|
|
232
|
+
warningData = data as WarningDataItem[]
|
|
233
|
+
warningEvent = events
|
|
234
|
+
} else if (key === 'position') {
|
|
235
|
+
positionData = data as PositionDataItem[]
|
|
236
|
+
positionEvent = events
|
|
237
|
+
} else if (key === 'condition') {
|
|
238
|
+
conditionData = data as ConditionDataItem[]
|
|
239
|
+
conditionEvent = events
|
|
276
240
|
}
|
|
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
|
-
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
// -----处理预警线-----
|
|
244
|
+
if (warningData.length > 0) {
|
|
245
|
+
elements = warningData.reduce((res, item: WarningDataItem) => {
|
|
246
|
+
const { value, text, info, config } = item
|
|
247
|
+
if (value > maxValue || value < minValue) {
|
|
248
|
+
// 当前数值超出图表范围,不绘制
|
|
249
|
+
return res
|
|
250
|
+
}
|
|
251
|
+
const params = {
|
|
252
|
+
y: echartsInstance.convertToPixel({ yAxisIndex: 0 }, value),
|
|
253
|
+
text,
|
|
254
|
+
info: { info, config: { ...warningConfig, ...config }, event: { ...warningEvent } },
|
|
255
|
+
gridLeft,
|
|
256
|
+
gridRight,
|
|
257
|
+
echartsWidth: echartsInstance.getWidth(),
|
|
258
|
+
echartsInstance,
|
|
259
|
+
}
|
|
260
|
+
return [...res, getWarningItem(params)]
|
|
261
|
+
}, elements)
|
|
262
|
+
}
|
|
263
|
+
// -----处理持仓线-----
|
|
264
|
+
if (positionData.length > 0) {
|
|
265
|
+
elements = positionData.reduce((res, item: PositionDataItem) => {
|
|
266
|
+
const { value, text, info, config } = item
|
|
267
|
+
// 数值超出图表范围的不绘制, 直接return
|
|
268
|
+
if (value > maxValue || value < minValue) {
|
|
269
|
+
// 当前数值超出图表范围,不绘制
|
|
270
|
+
return res
|
|
271
|
+
}
|
|
272
|
+
const params = {
|
|
273
|
+
y: echartsInstance.convertToPixel({ yAxisIndex: 0 }, value),
|
|
274
|
+
text,
|
|
275
|
+
info: { info, config: { ...positionConfig, ...config }, event: { ...positionEvent } },
|
|
276
|
+
gridLeft,
|
|
277
|
+
gridRight,
|
|
278
|
+
echartsWidth: echartsInstance.getWidth(),
|
|
279
|
+
echartsInstance,
|
|
280
|
+
}
|
|
281
|
+
return [...res, getPositionItem(params)]
|
|
282
|
+
}, elements)
|
|
283
|
+
}
|
|
284
|
+
// -----处理条件单-----
|
|
285
|
+
if (conditionData.length > 0) {
|
|
286
|
+
elements = conditionData.reduce((res, item: ConditionDataItem) => {
|
|
287
|
+
const { value, text, profitValue, profitText, lossValue, lossText, info, config } = item
|
|
288
|
+
// 数值超出图表范围的不绘制, 直接return
|
|
289
|
+
if (value > maxValue || value < minValue) {
|
|
290
|
+
return res
|
|
291
|
+
}
|
|
292
|
+
const params = {
|
|
293
|
+
y: echartsInstance.convertToPixel({ yAxisIndex: 0 }, value),
|
|
294
|
+
text,
|
|
295
|
+
profitY: echartsInstance.convertToPixel({ yAxisIndex: 0 }, profitValue),
|
|
296
|
+
profitText,
|
|
297
|
+
lossY: echartsInstance.convertToPixel({ yAxisIndex: 0 }, lossValue),
|
|
298
|
+
lossText,
|
|
299
|
+
info: { info, config: { ...conditionConfig, ...config }, event: { ...conditionEvent } },
|
|
300
|
+
gridLeft,
|
|
301
|
+
gridRight,
|
|
302
|
+
echartsWidth: echartsInstance.getWidth(),
|
|
303
|
+
echartsInstance,
|
|
304
|
+
}
|
|
305
|
+
return [...res, getConditionItem(params)]
|
|
306
|
+
}, elements)
|
|
307
|
+
}
|
|
312
308
|
}
|
|
313
309
|
|
|
314
310
|
// -----return------
|