66 lines
1.5 KiB
React
66 lines
1.5 KiB
React
|
import GraphBase from '../../../公共组件/GraphBase';
|
||
|
import ReactECharts from 'echarts-for-react';
|
||
|
import getOptions from '../../../../hooks/getChartOption';
|
||
|
|
||
|
// function rand(max) {
|
||
|
// return Math.ceil(Math.random() * max);
|
||
|
// }
|
||
|
// function getArr(len) {
|
||
|
// return Array(len).fill(1).map(() => rand(100))
|
||
|
// }
|
||
|
// function getArrs(len) {
|
||
|
// return Array(len).fill(1).map(() => getArr(7))
|
||
|
// }
|
||
|
// function fan4(...arrs) {
|
||
|
// const total = arrs[0].map((_, i) =>
|
||
|
// arrs.reduce((sum, arr) => sum + arr[i], 0),
|
||
|
// );
|
||
|
// arrs.unshift(total);
|
||
|
// return arrs;
|
||
|
// }
|
||
|
// function main() {
|
||
|
// // console.log(JSON.stringify(fan(getArrs(3))))
|
||
|
// console.log(fan(getArrs(3)))
|
||
|
// }
|
||
|
|
||
|
function Oxygen(props) {
|
||
|
function handleSwitch(v) {
|
||
|
console.log('switched ', v);
|
||
|
}
|
||
|
|
||
|
function handleDateChange(v) {
|
||
|
console.log('date ', v);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<GraphBase
|
||
|
icon="battery"
|
||
|
title="氧气含量"
|
||
|
desc="能耗趋势图"
|
||
|
switchOptions={true}
|
||
|
onSwitch={handleSwitch}
|
||
|
dateOptions={['日', '周', '月', '年']}
|
||
|
legend={['总量', '白班', '夜班']}
|
||
|
onDateChange={handleDateChange}
|
||
|
size={['long', 'middle']}
|
||
|
>
|
||
|
{/* real echarts here */}
|
||
|
<ReactECharts
|
||
|
key={Math.random()}
|
||
|
option={getOptions(
|
||
|
[
|
||
|
[172, 165, 135, 35, 101, 53, 68], // 总量
|
||
|
[87, 68, 81, 33, 35, 44, 38], // 白班
|
||
|
[85, 97, 54, 2, 66, 9, 30], // 夜班
|
||
|
],
|
||
|
'氧气',
|
||
|
)}
|
||
|
style={{ height: '100%' }}
|
||
|
/>
|
||
|
{/* real table data here */}
|
||
|
</GraphBase>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export default Oxygen;
|