fix: 新增图表类型

This commit is contained in:
MTrun
2022-02-02 18:17:45 +08:00
parent 9876c7a802
commit 41711b174f
14 changed files with 200 additions and 36 deletions
@@ -1,4 +1,5 @@
import { getUUID } from '@/utils'
import { echartOptionProfixHandle } from '@/packages/utils/chart'
import { BarCommonConfig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'
@@ -12,8 +13,7 @@ export default class Config implements CreateComponentType {
public attr = { x: 0, y: 0, w: 500, h: 300 }
// 图表配置项
public config = {
backgroundColor: 'rgba(0,0,0,0)',
public option = echartOptionProfixHandle({
tooltip: {
trigger: 'axis',
axisPointer: {
@@ -33,11 +33,11 @@ export default class Config implements CreateComponentType {
type: 'bar'
}
]
}
})
// 设置坐标
public setPosition(x: number, y: number): void {
this.attr.x = x
this.attr.y = y
}
}
}
@@ -1,9 +1,9 @@
<template>
<v-chart theme="dark" :option="option" autoresize />
<VChart theme="dark" :option="option" autoresize />
</template>
<script setup lang="ts">
import { computed, toRef, PropType } from 'vue'
import { computed, PropType } from 'vue'
import VChart from 'vue-echarts'
import { use, graphic } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
@@ -31,11 +31,6 @@ use([
])
const option = computed(() => {
return props.chartData.config
return props.chartData.option
})
const attr = toRef(props.chartData, 'attr')
</script>
<style lang="scss" scoped></style>
@@ -1,4 +1,5 @@
import { getUUID } from '@/utils'
import { echartOptionProfixHandle } from '@/packages/utils/chart'
import { BarCrossrangefig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'
@@ -12,7 +13,7 @@ export default class Config implements CreateComponentType {
public attr = { x: 0, y: 0, w: 500, h: 300 }
// 图表配置项
public config = {
public option = echartOptionProfixHandle({
backgroundColor: 'rgba(0,0,0,0)',
tooltip: {
trigger: 'axis',
@@ -33,7 +34,7 @@ export default class Config implements CreateComponentType {
type: 'bar'
}
]
}
})
// 设置坐标
public setPosition(x: number, y: number): void {
@@ -1,9 +1,9 @@
<template>
<v-chart theme="dark" :option="option" autoresize />
<VChart theme="dark" :option="option" autoresize />
</template>
<script setup lang="ts">
import { computed, toRef, PropType } from 'vue'
import { computed, PropType } from 'vue'
import VChart from 'vue-echarts'
import { use, graphic } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
@@ -31,11 +31,8 @@ use([
])
const option = computed(() => {
return props.chartData.config
return props.chartData.option
})
const attr = toRef(props.chartData, 'attr')
</script>
<style lang="scss" scoped></style>