|
@@ -22,6 +22,11 @@ let colors = [
|
|
|
];
|
|
|
let option = {
|
|
|
backgroundColor: "rgba(0,0,0,0)",
|
|
|
+ label: {
|
|
|
+ //图例文字的样式
|
|
|
+ color: "#fff",
|
|
|
+ fontSize: 16,
|
|
|
+ },
|
|
|
title: {
|
|
|
// text: "报建数量",
|
|
|
x: "20%",
|
|
@@ -173,17 +178,17 @@ export default {
|
|
|
cartData.data.forEach((item, index) => {
|
|
|
option.legend.data.push(item.name);
|
|
|
item.itemStyle = {
|
|
|
- // color: colors[index % colors.length],
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
- {
|
|
|
- offset: 0,
|
|
|
- color: colors[index % colors.length],
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: colors[index % colors.length],
|
|
|
- },
|
|
|
- ]),
|
|
|
+ color: colors[index % colors.length],
|
|
|
+ // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ // {
|
|
|
+ // offset: 0,
|
|
|
+ // color: colors[index % colors.length],
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // offset: 1,
|
|
|
+ // color: colors[index % colors.length],
|
|
|
+ // },
|
|
|
+ // ]),
|
|
|
};
|
|
|
// dataAll += item.value;
|
|
|
});
|
|
@@ -200,9 +205,9 @@ export default {
|
|
|
option.legend.top = "center";
|
|
|
option.legend.orient = "vertical";
|
|
|
}
|
|
|
- option.legend.right= cartData.legend_right||"2%"
|
|
|
- let max = cartData.max || 4
|
|
|
- option.legend.textStyle.rich.name.width = max * 15
|
|
|
+ option.legend.right = cartData.legend_right || "2%";
|
|
|
+ let max = cartData.max || 4;
|
|
|
+ option.legend.textStyle.rich.name.width = max * 15;
|
|
|
option.legend.formatter = function (name) {
|
|
|
const sItem = cartData.data.find((item) =>
|
|
|
`${item.name}`.includes(`${name}`)
|
|
@@ -228,7 +233,7 @@ export default {
|
|
|
_this.$emit("echartClick", params.name, params.selected[params.name]);
|
|
|
});
|
|
|
this.myChart.on("click", function (params) {
|
|
|
- _this.$emit("echartClick", params.name);
|
|
|
+ _this.$emit("echartClick", params.name, { color: params.color });
|
|
|
});
|
|
|
// }
|
|
|
},
|