mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 新增图表居中拖拽
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import { getUUID } from '@/utils'
|
||||
import { BarCommonConfig } from './index'
|
||||
|
||||
export const chartSize = {
|
||||
w: 500,
|
||||
h: 300
|
||||
}
|
||||
|
||||
export default class Config {
|
||||
private id: string = getUUID()
|
||||
private key: string = BarCommonConfig.key
|
||||
public attr = { x: 0, y: 0, w: 500, h: 300 }
|
||||
public attr = { x: 0, y: 0, ...chartSize }
|
||||
|
||||
// 图表配置项
|
||||
public config = {
|
||||
@@ -17,21 +22,21 @@ export default class Config {
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [120, 200, 150, 80, 70, 110, 130],
|
||||
type: 'bar',
|
||||
},
|
||||
],
|
||||
type: 'bar'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// 设置坐标
|
||||
public setPosition(x: number, y: number):void {
|
||||
public setPosition(x: number, y: number): void {
|
||||
this.attr.x = x
|
||||
this.attr.y = y
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import BarCommon from './index.vue'
|
||||
import image from '@/assets/images/chart/charts/bar_x.png'
|
||||
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
import { chartSize } from './config'
|
||||
|
||||
export const BarCommonConfig: ConfigType = {
|
||||
key: 'VBarCommon',
|
||||
@@ -10,5 +11,6 @@ export const BarCommonConfig: ConfigType = {
|
||||
categoryName: ChatCategoryEnumName.BAR,
|
||||
package: PackagesCategoryEnum.CHARTS,
|
||||
node: BarCommon,
|
||||
image: image
|
||||
image: image,
|
||||
chartData: { chartSize }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user