Browse Source

图表颜色调整

dev
‘lijianhao’ 2 years ago
parent
commit
15e3643bfd
  1. 11
      web/client/src/sections/quanju/containers/footer/conserve/left/left-bottom.js
  2. 46
      web/client/src/sections/quanju/containers/footer/conserve/right/right-bottom.js

11
web/client/src/sections/quanju/containers/footer/conserve/left/left-bottom.js

@ -2,12 +2,12 @@ import React from 'react'
import Module from '../../../public/module' import Module from '../../../public/module'
import PieChart from '../chart/pie-chart'; import PieChart from '../chart/pie-chart';
let colorList = [ let color = [
"rgba(7,185,254,1)", "rgba(7,185,254,1)",
"rgba(28,96,254,1)", "rgba(28,96,254,1)",
"rgba(4,251,240,1)", "rgba(4,251,240,1)",
] ]
let underColorList = [ let underColor = [
"rgba(7,185,254,0.5)", "rgba(7,185,254,0.5)",
"rgba(28,96,254,0.5)", "rgba(28,96,254,0.5)",
"rgba(4,251,240,0.5)", "rgba(4,251,240,0.5)",
@ -22,9 +22,14 @@ const LeftBottom = (props) => {
totalData += s.isGreen totalData += s.isGreen
return { return {
name: grade[index], name: grade[index],
value: s.isGreen.toFixed(3) value: s.isGreen.toFixed(3),
colorList: color[index],
underColorList: underColor[index]
} }
}) })
let colorList = value?.map(c =>c.colorList)
let underColorList = value?.map(c =>c.underColorList)
return ( return (
<> <>

46
web/client/src/sections/quanju/containers/footer/conserve/right/right-bottom.js

@ -2,18 +2,18 @@ import React from 'react'
import Module from '../../../public/module' import Module from '../../../public/module'
import PieChart from '../chart/pie-chart'; import PieChart from '../chart/pie-chart';
let colorList = [ // let colorList = [
"rgba(7,185,254,1)", // "rgba(7,185,254,1)",
"rgba(28,96,254,1)", // "rgba(28,96,254,1)",
"rgba(4,251,240,1)", // "rgba(4,251,240,1)",
"rgba(255,194,20,1)" // "rgba(255,194,20,1)"
] // ]
let underColorList = [ // let underColorList = [
"rgba(7,185,254,0.5)", // "rgba(7,185,254,0.5)",
"rgba(28,96,254,0.5)", // "rgba(28,96,254,0.5)",
"rgba(4,251,240,0.5)", // "rgba(4,251,240,0.5)",
"rgba(255,194,20,0.5)" // "rgba(255,194,20,0.5)"
] // ]
const type = ['culvert', '', 'road', 'bridge'] const type = ['culvert', '', 'road', 'bridge']
@ -30,27 +30,37 @@ const RightBottom = (props) => {
case 'road': case 'road':
return { return {
name: '道路', name: '道路',
value: r.count value: r.count,
colorList: 'rgba(7,185,254,1)',
underColorList: 'rgba(7,185,254,0.5)'
}; };
case 'culvert': case 'culvert':
return { return {
name: '涵洞', name: '涵洞',
value: r.count value: r.count,
colorList: 'rgba(4,251,240,1)',
underColorList: 'rgba(4,251,240,0.5)'
}; };
case 'bridge': case 'bridge':
return { return {
name: '桥梁', name: '桥梁',
value: r.count value: r.count,
colorList: 'rgba(28,96,254,1)',
underColorList: 'rgba(28,96,254,0.5)'
}; };
case 'other': case 'other':
return { return {
name: '其他', name: '其他',
value: r.count value: r.count,
colorList: 'rgba(255,194,20,1)',
underColorList: 'rgba(255,194,20,0.5)'
}; };
} }
}).filter(f => f !== undefined) }).filter(f => f !== undefined)
// const otherNum = totalData - typesNum console.log('list:',list);
// otherNum !== null && list?.push({ name: '其他', value: otherNum }) let colorList = list?.map(c => c.colorList)
let underColorList =list?.map(c => c.underColorList)
const style = { height: "31%", marginTop: "3%" } const style = { height: "31%", marginTop: "3%" }
return ( return (
<> <>

Loading…
Cancel
Save