CEES-CMD/ant-design-vue-jeecg/src/components/chart/TransferBar.vue

66 lines
1.2 KiB
Java
Raw Normal View History

2019-02-25 15:58:05 +08:00
<template>
<div :style="{ padding: '0 0 32px 32px' }">
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4>
<v-chart
2019-04-14 16:20:04 +08:00
:height="height"
2019-02-25 15:58:05 +08:00
:data="data"
:scale="scale"
:forceFit="true"
:padding="['auto', 'auto', '40', '50']">
2019-04-14 16:20:04 +08:00
<v-tooltip/>
<v-axis/>
2019-02-25 15:58:05 +08:00
<v-bar position="x*y"/>
</v-chart>
</div>
</template>
<script>
export default {
2019-04-14 16:20:04 +08:00
name: 'Bar',
2019-02-25 15:58:05 +08:00
props: {
title: {
type: String,
default: ''
2019-04-14 16:20:04 +08:00
},
x: {
type: String,
default: 'x'
},
y: {
type: String,
default: 'y'
},
data: {
type: Array,
default: () => []
},
height: {
type: Number,
default: 254
2019-02-25 15:58:05 +08:00
}
},
2019-04-14 16:20:04 +08:00
data() {
return {}
},
computed: {
scale() {
return [
{ dataKey: 'x', title: this.x, alias: this.x },
{ dataKey: 'y', title: this.y, alias: this.y }
]
2019-02-25 15:58:05 +08:00
}
},
2019-04-14 16:20:04 +08:00
created() {
// this.getMonthBar()
2019-02-25 15:58:05 +08:00
},
methods: {
2019-04-14 16:20:04 +08:00
// getMonthBar() {
// this.$http.get('/analysis/month-bar')
// .then(res => {
// this.data = res.result
// })
// }
2019-02-25 15:58:05 +08:00
}
}
</script>