12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <el-row>
- <div id="index1" ref="echartD" style="width:100%;height:300px;"></div>
- </el-row>
- </template>
- <script>
- import * as echarts from "echarts";
- export default {
- props: ["resData"],
- data() {
- return {};
- },
- watch: {
- resData() {
- this.getData();
- },
- },
- mounted() {
- this.getData();
- },
- methods: {
- getData() {
- setTimeout(() =>{
- let data = this.resData
- echarts.init(this.$refs.echartD).setOption({
- series: [
- // 进度条
- {
- name: "仪表盘",
- type: "gauge",
- radius: "55%", // 半径
- startAngle: 270, //开始角度 左侧角度
- endAngle: -89.999, //结束角度 右侧
- splitNumber: 30,
- axisLine: {
- lineStyle: {
- color: [
- [0, "#80FFA5"],
- [1, "#FF5801"],
- ],
- width: 10,
- },
- },
- axisLabel: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- splitLine: {
- show: false,
- },
- itemStyle: {
- show: false,
- },
- detail: {
- formatter: () => {
- return `电量:${data.dianliang}%\n信号:${data.xinhao}`;
- },
- offsetCenter: [0, "0%"],
- textStyle: {
- fontSize: 16,
- fontWeight: "700",
- height:20,
- color:"#80FFA5",
- fontFamily: '"DS", "DS-B", "DS-BB", "DS-BS"',
- },
- },
- title: {
- offsetCenter: [0, "10%"],
- },
- pointer: {
- show: false,
- },
- data: [
- (`电量:${data.dianliang}%\n信号:${data.xinhao}`),
- ],
- },
- ],
- })
- window.addEventListener("resize", function() {
- myChart.resize();
- });
- },1000)
- },
- }
- };
- </script>
- <style lang="scss" scoped></style>
|