lineColor设置所有柱状图柱子的颜色
通过这个 this.barChartOption.ser[0].lineColor获取到所有添加进去的柱子颜色,
怎样获取单个数据的lineColor并设置颜色?
所有的数据push进去的
求大神解答???
<template>
<bar-chart ref="barChart"></bar-chart>
</template>
<script>
import { forEachToJson } from "tool/tool.js";
import barChart from "local/charts/bar/index.vue";
import allData from "../configure/allData.js";
import projectOption from "controller/projectOption.js";
export default {
data(){
return{
projectOption: projectOption,
barChartOption: {
axis: [],
id: "barChart",
barWidth: 20,
unils:"百万",
ser: [
{ data: [], name: "县", tianc: true , lineColor: "orange"}
]
},
}
},
computed: {
// pageData() {
// return this.$store.state.onlineRetailersIndex.pageData.leftTop;
// }
},
components: {
barChart,
},
mounted() {
},
methods:{
makePage() {
this.barChartOption.axis =[];
this.barChartOption.ser[0].data = [];
this.barChartOption.make = {yName: ""};
if(allData){
this.barChartOption.make = {
grid: {
top: "15%",
left: "2%",
right: "2%",
bottom: "5%"
},
xRotate: -50,
yName:"单位:百万",
interval:true,
};
var dataList=[];
forEachToJson(allData, (key,v) => {
v.forEach((v,i) => {
dataList.push({ name: v.name, value: (v.value*100).toFixed(0) });
});
});
dataList.eltSort("value").reverse().forEach((v,i)=>{
this.barChartOption.axis.push(v.name);
this.barChartOption.ser[0].data.push(v.value);
// console.log(this.barChartOption.ser[0]);
// if(v.name==projectOption.projectName){
// this.barChartOption.ser[0].lineColor="red";
// }
});
}
this.$refs.barChart.makeChart(this.barChartOption);
}
}
}
</script>