修复同一系列下,不同item下对应不同颜色的问题
This commit is contained in:
@@ -7,7 +7,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 {
|
export default {
|
||||||
name: "AiEchartV2",
|
name: "AiEchartV2",
|
||||||
@@ -57,9 +64,9 @@ export default {
|
|||||||
let {type, data, ops: options = {}} = this,
|
let {type, data, ops: options = {}} = this,
|
||||||
style = this.series ? this.series : this.ops.daemon ? this.ops.daemon : {},
|
style = this.series ? this.series : this.ops.daemon ? this.ops.daemon : {},
|
||||||
colors = this.theme === '1' ? this.colors : (options.color || this.colors),
|
colors = this.theme === '1' ? this.colors : (options.color || this.colors),
|
||||||
legend = {textStyle: {color: '#fff', padding: [0, 0, 0, 8], fontSize: 14}, show: false},
|
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)
|
const series = data?.[0] ? Array(Object.keys(data?.[0]).length - 1).fill(1)
|
||||||
.map((e, i) => ({type, ...daemon, ...(typeof style == 'object' ? style : style(colors[i]))})) : []
|
.map((e, i) => ({type, ...mergeOps(daemon, typeof style == 'object' ? style : style(colors[i]))})) : []
|
||||||
return {
|
return {
|
||||||
tooltip: {},
|
tooltip: {},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
|||||||
Reference in New Issue
Block a user