|
@@ -28,7 +28,7 @@ export default {
|
|
"barReverse",
|
|
"barReverse",
|
|
"pie",
|
|
"pie",
|
|
"line",
|
|
"line",
|
|
- "darkLine",
|
|
|
|
|
|
+ "darkLines",
|
|
"barGroup",
|
|
"barGroup",
|
|
"lineGroup"
|
|
"lineGroup"
|
|
].indexOf(value) !== -1
|
|
].indexOf(value) !== -1
|
|
@@ -184,23 +184,66 @@ export default {
|
|
]
|
|
]
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- getDarkLineOption(datas) {
|
|
|
|
- let labels = [],
|
|
|
|
- vals = [];
|
|
|
|
- datas.map(item => {
|
|
|
|
- labels.push(item.name);
|
|
|
|
- vals.push(item.value);
|
|
|
|
- });
|
|
|
|
- const linearColor = new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
|
|
|
|
|
+ getDarkLinesOption(datas) {
|
|
|
|
+ if (!datas.length) return;
|
|
|
|
+ const labels = datas[0].data.map(item => item.name);
|
|
|
|
+ const colors = [
|
|
{
|
|
{
|
|
- offset: 1,
|
|
|
|
- color: "rgba(21, 91, 146,1)"
|
|
|
|
|
|
+ color: "rgba(204, 70, 53,1)",
|
|
|
|
+ lineColor: "rgba(204, 70, 53,0.6)",
|
|
|
|
+ linearColor: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
|
|
|
+ {
|
|
|
|
+ offset: 1,
|
|
|
|
+ color: "rgba(204, 70, 53,1)"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 0,
|
|
|
|
+ color: "rgba(204, 70, 53,0)"
|
|
|
|
+ }
|
|
|
|
+ ]),
|
|
|
|
+ z: 3
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- offset: 0,
|
|
|
|
- color: "rgba(21, 91, 146,0)"
|
|
|
|
|
|
+ color: "rgba(21, 91, 146,1)",
|
|
|
|
+ lineColor: "rgba(21, 91, 146,0.6)",
|
|
|
|
+ linearColor: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
|
|
|
+ {
|
|
|
|
+ offset: 1,
|
|
|
|
+ color: "rgba(21, 91, 146,1)"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 0,
|
|
|
|
+ color: "rgba(21, 91, 146,0)"
|
|
|
|
+ }
|
|
|
|
+ ]),
|
|
|
|
+ z: 4
|
|
}
|
|
}
|
|
- ]);
|
|
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ const series = datas.map(function(item, index) {
|
|
|
|
+ const data = item.data.map(function(elem) {
|
|
|
|
+ return elem.value;
|
|
|
|
+ });
|
|
|
|
+ const color = colors[index];
|
|
|
|
+ return {
|
|
|
|
+ name: item.name,
|
|
|
|
+ type: "line",
|
|
|
|
+ smooth: true,
|
|
|
|
+ data: data,
|
|
|
|
+ symbol: "circle",
|
|
|
|
+ symbolSize: 6,
|
|
|
|
+ z: color.z,
|
|
|
|
+ itemStyle: {
|
|
|
|
+ color: color.color
|
|
|
|
+ },
|
|
|
|
+ lineStyle: {
|
|
|
|
+ color: color.lineColor
|
|
|
|
+ },
|
|
|
|
+ areaStyle: {
|
|
|
|
+ color: color.linearColor
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
|
|
return {
|
|
return {
|
|
animation: this.animationIsOpen,
|
|
animation: this.animationIsOpen,
|
|
@@ -211,7 +254,19 @@ export default {
|
|
right: "3%"
|
|
right: "3%"
|
|
},
|
|
},
|
|
tooltip: {
|
|
tooltip: {
|
|
- show: true
|
|
|
|
|
|
+ show: true,
|
|
|
|
+ formatter: function(params) {
|
|
|
|
+ return params.value + "%";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ legend: {
|
|
|
|
+ data: datas.map(data => data.name),
|
|
|
|
+ right: "3%",
|
|
|
|
+ itemWidth: 14,
|
|
|
|
+ textStyle: {
|
|
|
|
+ color: "#9d9c9c",
|
|
|
|
+ fontSize: 14
|
|
|
|
+ }
|
|
},
|
|
},
|
|
xAxis: {
|
|
xAxis: {
|
|
type: "category",
|
|
type: "category",
|
|
@@ -251,31 +306,14 @@ export default {
|
|
},
|
|
},
|
|
axisLabel: {
|
|
axisLabel: {
|
|
fontSize: 12,
|
|
fontSize: 12,
|
|
- color: "#9d9c9c"
|
|
|
|
|
|
+ color: "#9d9c9c",
|
|
|
|
+ formatter: "{value}%"
|
|
},
|
|
},
|
|
axisTick: {
|
|
axisTick: {
|
|
show: false
|
|
show: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- series: [
|
|
|
|
- {
|
|
|
|
- name: "数量",
|
|
|
|
- type: "line",
|
|
|
|
- smooth: true,
|
|
|
|
- data: vals,
|
|
|
|
- symbol: "circle",
|
|
|
|
- symbolSize: 8,
|
|
|
|
- itemStyle: {
|
|
|
|
- color: "rgba(21, 91, 146, 1)"
|
|
|
|
- },
|
|
|
|
- lineStyle: {
|
|
|
|
- color: "rgba(21, 91, 146, 0.6)"
|
|
|
|
- },
|
|
|
|
- areaStyle: {
|
|
|
|
- color: linearColor
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ series: series
|
|
};
|
|
};
|
|
},
|
|
},
|
|
getPieOption(datas) {
|
|
getPieOption(datas) {
|