mirror of
https://github.com/dataease/dataease.git
synced 2026-05-23 22:08:34 +08:00
feat(视图): 视图组件临时封装
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
<script>
|
||||
import { BASE_BAR, BASE_LINE } from '../chart/chart'
|
||||
import { baseBarOption } from '../chart/bar/baseBar'
|
||||
import { baseLineOption } from '../chart/line/baseLine'
|
||||
|
||||
export default {
|
||||
name: 'ChartComponent',
|
||||
@@ -35,28 +37,11 @@ export default {
|
||||
let chart_option = {}
|
||||
// todo type
|
||||
if (chart.type === 'bar') {
|
||||
chart_option = JSON.parse(JSON.stringify(BASE_BAR))
|
||||
chart_option = baseBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
|
||||
} else if (chart.type === 'line') {
|
||||
chart_option = JSON.parse(JSON.stringify(BASE_LINE))
|
||||
chart_option = baseLineOption(JSON.parse(JSON.stringify(BASE_LINE)), chart)
|
||||
}
|
||||
// console.log(chart_option);
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
chart_option.xAxis.data = chart.data.x
|
||||
chart.data.series.forEach(function(y) {
|
||||
chart_option.legend.data.push(y.name)
|
||||
chart_option.series.push(y)
|
||||
})
|
||||
}
|
||||
// console.log(chart_option);
|
||||
// 处理shape attr
|
||||
if (chart.customAttr) {
|
||||
const customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
}
|
||||
this.myEcharts(chart_option)
|
||||
},
|
||||
myEcharts(option) {
|
||||
|
||||
Reference in New Issue
Block a user