允许echart在组件内更换图标类型
This commit is contained in:
@@ -15,6 +15,7 @@ export default {
|
||||
data: {default: () => []},
|
||||
ops: {default: () => ({})},
|
||||
type: {default: "line"},
|
||||
tpl: String,
|
||||
series: Object,
|
||||
theme: {
|
||||
default: '0'
|
||||
@@ -51,14 +52,13 @@ export default {
|
||||
|
||||
return ['#FFBA44', '#EC6666', '#FF3E18', '#C9FF82', '#29D7FA', '#ea7ccc']
|
||||
},
|
||||
|
||||
chartOptions() {
|
||||
let {type, data, ops: options = {}} = this,
|
||||
style = this.series ? this.series : this.ops.daemon ? this.ops.daemon : {},
|
||||
colors = this.theme === '1' ? this.colors : (options.color || this.colors),
|
||||
legend = {textStyle: {color: '#fff', padding: [0, 0, 0, 8], fontSize: 14}, show: false},
|
||||
series = data?.[0] ? Array(Object.keys(data?.[0]).length - 1).fill(1)
|
||||
.map((e, i) => ({type, ...(typeof style == 'object' ? style : style(colors[i]))})) : []
|
||||
.map((e, i) => ({type, ...(typeof style == 'object' ? style : style(colors[i]))})) : []
|
||||
return {
|
||||
tooltip: {},
|
||||
xAxis: {
|
||||
@@ -118,9 +118,11 @@ export default {
|
||||
this.getChartData(oldDims != current)
|
||||
}
|
||||
},
|
||||
|
||||
theme() {
|
||||
this.refresh()
|
||||
},
|
||||
tpl(v) {
|
||||
v && this.refresh()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -149,7 +151,7 @@ export default {
|
||||
|
||||
if (copy && typeof copy == 'object') {
|
||||
// 递归调用
|
||||
target[name] = this.deepAssign( src, copy)
|
||||
target[name] = this.deepAssign(src, copy)
|
||||
} else if (copy !== undefined) {
|
||||
target[name] = copy
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user