44 lines
826 B
TypeScript
Raw Normal View History

2022-01-24 21:12:18 +08:00
import { getUUID } from '@/utils'
2022-01-25 18:19:44 +08:00
import { BarCommonConfig } from './index'
2022-01-24 21:12:18 +08:00
2022-01-27 23:16:51 +08:00
export const chartSize = {
w: 500,
h: 300
}
2022-01-25 11:09:32 +08:00
export default class Config {
2022-01-25 22:29:44 +08:00
private id: string = getUUID()
private key: string = BarCommonConfig.key
2022-01-27 23:16:51 +08:00
public attr = { x: 0, y: 0, ...chartSize }
2022-01-25 18:19:44 +08:00
// 图表配置项
2022-01-24 21:12:18 +08:00
public config = {
2022-01-25 22:29:44 +08:00
backgroundColor: 'rgba(0,0,0,0)',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: {
type: 'category',
2022-01-27 23:16:51 +08:00
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
2022-01-25 22:29:44 +08:00
},
yAxis: {
2022-01-27 23:16:51 +08:00
type: 'value'
2022-01-25 22:29:44 +08:00
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
2022-01-27 23:16:51 +08:00
type: 'bar'
}
]
2022-01-24 21:12:18 +08:00
}
2022-01-25 18:19:44 +08:00
// 设置坐标
2022-01-27 23:16:51 +08:00
public setPosition(x: number, y: number): void {
2022-01-25 18:19:44 +08:00
this.attr.x = x
this.attr.y = y
}
2022-01-24 21:12:18 +08:00
}