diff --git a/web/client/src/sections/quanju/containers/footer/build/Rightbottom.js b/web/client/src/sections/quanju/containers/footer/build/Rightbottom.js index 8add83ce..c236367f 100644 --- a/web/client/src/sections/quanju/containers/footer/build/Rightbottom.js +++ b/web/client/src/sections/quanju/containers/footer/build/Rightbottom.js @@ -5,7 +5,7 @@ import React, { useEffect, useRef } from 'react'; // import ReactEcharts from 'echarts-for-react'; import * as echarts from 'echarts'; function Rightbottom(props) { - const { width, height, data, total, text } = props + const { width, height, total,data, text } = props const chartRef = useRef(null); let colorList = [ "rgba(7,185,254,1)", @@ -32,9 +32,25 @@ function Rightbottom(props) { // {name: '等外公路', value: 30}, // ] - console.log(data,'数据') - data?.sort((a,b)=>b.value - a.value) - data?.forEach(d => { + +const rightLegend = ['一级公路', '二级公路', '三级公路','四级公路','等外公路'] +// let data=[ +// {name: "四级公路", value: 2969}, +// {name: "等外公路", value: 171}, +// {name: "三级公路", value: 103}, +// {name: "二级公路", value: 15}, +// ] +// console.log(data.map(i=>i.name),'jjj') +let dataq = rightLegend.map((item,index)=>{ + if(data.map(i=>i.name).includes(item)){ + return {name:item,value:data.filter(i1=>i1.name===item)[0].value} + }else{ + return {name:item,value:0} + } +}) + console.log(dataq,'数据') + dataq?.sort((a,b)=>b.value - a.value) + dataq?.forEach(d => { name.push(d.name) emptyName.push({ name: '', @@ -45,7 +61,7 @@ function Rightbottom(props) { const title = '基础设施安全监测版块'; // const number = 2738; // const leftLegend = ['地灾', '桥梁', '基坑', '边坡', '水库大坝'] - const rightLegend = ['一级公路', '二级公路', '三级公路','四级公路','等外公路'] + const legendColor = undefined; var titleNum = 15 @@ -127,7 +143,7 @@ function Rightbottom(props) { label: { show: false }, - data: data, + data: dataq, }, ], };