diff --git a/package.json b/package.json index 1660aed5e880221d987076b56342ad08c4ebc465..be2749511dcd02348e46a82f5fb4b4b91a040e15 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build": "node build/build.js" }, "dependencies": { - "@antv/g6": "^3.4.8", + "@antv/g6": "^3.5.1", "@fortawesome/fontawesome-free": "^5.8.0", "ace-builds": "^1.4.11", "axios": "^0.19.2", diff --git a/src/components/e-charts/multiple_circle.vue b/src/components/e-charts/multiple_circle.vue index c1113495fd4471e0a468cead11b45a6ad9d45b57..bd27aad2351d4595c88ba9c4fb8498412f7232b2 100644 --- a/src/components/e-charts/multiple_circle.vue +++ b/src/components/e-charts/multiple_circle.vue @@ -6,55 +6,74 @@ import uuidv1 from "uuid/v1"; var echarts = require("echarts"); export default { - props: ['data','text'], + props: { + data: { + type: Array, + default: () => { + return []; + } + }, + text: { + type: String, + default: "" + }, + show_center_data: { + type: Boolean, + default: true + }, + bar_width: { + type: Number, + default: 5 + } + }, components: {}, data() { return { - yylx_asy: uuidv1(), + yylx_asy: uuidv1() }; }, watch: {}, computed: {}, created() {}, mounted() { - this.init_yylx_asy(this.data,this.text) + this.init_yylx_asy(this.data, this.text); }, methods: { - init_yylx_asy(data,text) { - var options = this.init_circle(data,text); + init_yylx_asy(data, text) { + var options = this.init_circle(data, text); window[this.yylx_asy] = echarts.init( document.getElementById(this.yylx_asy) ); window[this.yylx_asy].setOption(options, true); }, - init_circle(data_val,text) { + init_circle(data_val, text) { // var data_val = data_val; var rich = { white: { color: "#ddd", align: "center", - padding: [3, 0], - }, + padding: [3, 0] + } }; var placeHolderStyle = { normal: { label: { - show: false, + show: false }, labelLine: { - show: false, + show: false }, color: "rgba(0, 0, 0, 0)", borderColor: "rgba(0, 0, 0, 0)", - borderWidth: 0, - }, + borderWidth: 0 + } }; var data = []; - var total = 4; - var color = ["#515fe7", "#36a5ec", "#da9f2a", "#23b2a7", "#d46002"]; + var total = 0; + var color = ["#274fee", "#25bdb1", "#ffc95c", "#e56600", "#e15260"]; var legendarr = []; var temp2_data = 0; - data_val.forEach((e) => { + data_val.forEach(e => { temp2_data = temp2_data + e.value; }); for (var i = 0; i < data_val.length; i++) { @@ -64,17 +83,17 @@ export default { name: data_val[i].name, itemStyle: { normal: { - borderWidth: 5, + borderWidth: this.bar_width, // shadowBlur: 20, - borderColor: color[i], + borderColor: color[i] // shadowColor: color[i], - }, - }, + } + } }, { value: temp2_data / 20, name: "", - itemStyle: placeHolderStyle, + itemStyle: placeHolderStyle } ); legendarr.push(data_val[i].name); @@ -96,43 +115,43 @@ export default { show: true, position: "outside", color: "#58617a", - formatter: (params)=> { + formatter: params => { var percent = 0; - + percent = ((params.value / total) * 100).toFixed(2); if (params.name !== "") { - return percent+"%"; + return percent + "%"; } else { return ""; } }, - rich: rich, - }, - }, + rich: rich + } + } }, - data: data, - }, + data: data + } ]; var options = { title: { - text: total, + text: this.show_center_data ? total : "", textStyle: { color: "#000", fontSize: 40, - fontWeight: 200, + fontWeight: 200 }, subtext: text, subtextStyle: { - color: "#c9cedd", + color: "#c9cedd" }, itemGap: -10, // 主副标题距离 left: "center", - top: "center", + top: "center" }, color: color, tooltip: { - show: false, + show: false }, legend: { bottom: -5, @@ -141,17 +160,17 @@ export default { itemHeight: 10, orient: "horizontal", data: legendarr, - backgroundColor: "#f4f7fc", + backgroundColor: "#f4f7fc" }, toolbox: { - show: false, + show: false }, - series: seriesObj, + series: seriesObj }; return options; - }, - }, + } + } }; diff --git a/src/components/e-charts/starlist.vue b/src/components/e-charts/starlist.vue index 40f4ab97e25c3fb5eee2145faf3f6013f714502c..dca6ae8e22da9567780e869e4ba4a243d17e1dcc 100644 --- a/src/components/e-charts/starlist.vue +++ b/src/components/e-charts/starlist.vue @@ -1,24 +1,22 @@