修复同一系列下,不同item下对应不同颜色的问题

This commit is contained in:
aixianling
2024-04-10 17:35:07 +08:00
parent f50bd497be
commit a4d4e3cea5

View File

@@ -7,7 +7,14 @@
</template>
<script>
const mergeOps = (ori = {}, ext = {}) => {
for (const k in ext) {
if (typeof ext[k] == 'object') {
ori[k] = mergeOps(ori[k], ext[k])
} else ori[k] = ext[k]
}
return ori
}
export default {
name: "AiEchartV2",
@@ -57,9 +64,9 @@ export default {
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, ...daemon, ...(typeof style == 'object' ? style : style(colors[i]))})) : []
legend = {textStyle: {color: '#fff', padding: [0, 0, 0, 8], fontSize: 14}, show: false}
const series = data?.[0] ? Array(Object.keys(data?.[0]).length - 1).fill(1)
.map((e, i) => ({type, ...mergeOps(daemon, typeof style == 'object' ? style : style(colors[i]))})) : []
return {
tooltip: {},
xAxis: {