|
|
@@ -280,7 +280,10 @@ const DeviceBoard = () => {
|
|
|
},
|
|
|
]);
|
|
|
if (res.status === 200) {
|
|
|
- const x = res.result.map((item: any) => item.data.timeString).reverse();
|
|
|
+ // const x = res.result.map((item: any) => item.data.timeString).reverse();
|
|
|
+ const x = res.result
|
|
|
+ .map((item: any) => (_time === '1h' ? `${item.data.timeString}时` : item.data.timeString))
|
|
|
+ .reverse();
|
|
|
const y = res.result.map((item: any) => item.data.value).reverse();
|
|
|
setOptions({
|
|
|
xAxis: {
|
|
|
@@ -334,150 +337,6 @@ const DeviceBoard = () => {
|
|
|
],
|
|
|
});
|
|
|
}
|
|
|
- // if (data && data.time.type !== 'today') {
|
|
|
- // const res = await service.dashboard([
|
|
|
- // {
|
|
|
- // dashboard: 'device',
|
|
|
- // object: 'message',
|
|
|
- // measurement: 'quantity',
|
|
|
- // dimension: 'agg',
|
|
|
- // group: 'device_msg',
|
|
|
- // params: {
|
|
|
- // time: '1d',
|
|
|
- // format: 'yyyy.MM.dd',
|
|
|
- // limit: Math.ceil((data.time.end - data.time.start) / (1 * 24 * 3600 * 1000) + 1),
|
|
|
- // // from: moment(data.time.start).format('yyyy-MM-DD HH:MM:SS'),
|
|
|
- // // to: moment(data.time.end).format('yyyy-MM-DD HH:MM:SS'),
|
|
|
- // from: data.time.start,
|
|
|
- // to: data.time.end,
|
|
|
- // },
|
|
|
- // },
|
|
|
- // ]);
|
|
|
- // if (res.status === 200) {
|
|
|
- // const x = res.result.map((item: any) => item.data.timeString).reverse();
|
|
|
- // const y = res.result.map((item: any) => item.data.value).reverse();
|
|
|
- // setOptions({
|
|
|
- // xAxis: {
|
|
|
- // type: 'category',
|
|
|
- // boundaryGap: false,
|
|
|
- // data: x,
|
|
|
- // },
|
|
|
- // yAxis: {
|
|
|
- // type: 'value',
|
|
|
- // },
|
|
|
- // tooltip: {
|
|
|
- // trigger: 'axis',
|
|
|
- // // axisPointer: {
|
|
|
- // // type: 'shadow',
|
|
|
- // // },
|
|
|
- // },
|
|
|
- // grid: {
|
|
|
- // top: '2%',
|
|
|
- // bottom: '5%',
|
|
|
- // left: '50px',
|
|
|
- // right: '50px',
|
|
|
- // },
|
|
|
- // series: [
|
|
|
- // {
|
|
|
- // name: '消息量',
|
|
|
- // data: y,
|
|
|
- // type: 'line',
|
|
|
- // smooth: true,
|
|
|
- // color: '#685DEB',
|
|
|
- // areaStyle: {
|
|
|
- // color: {
|
|
|
- // type: 'linear',
|
|
|
- // x: 0,
|
|
|
- // y: 0,
|
|
|
- // x2: 0,
|
|
|
- // y2: 1,
|
|
|
- // colorStops: [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: '#685DEB', // 100% 处的颜色
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 1,
|
|
|
- // color: '#FFFFFF', // 0% 处的颜色
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // global: false, // 缺省为 false
|
|
|
- // },
|
|
|
- // },
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // });
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // const res = await service.dashboard([
|
|
|
- // {
|
|
|
- // dashboard: 'device',
|
|
|
- // object: 'message',
|
|
|
- // measurement: 'quantity',
|
|
|
- // dimension: 'agg',
|
|
|
- // group: 'device_msg',
|
|
|
- // params: {
|
|
|
- // time: '1h',
|
|
|
- // format: 'yyyy.MM.dd HH:MM:SS',
|
|
|
- // limit: 24,
|
|
|
- // from: data.time.start,
|
|
|
- // to: data.time.end,
|
|
|
- // },
|
|
|
- // },
|
|
|
- // ]);
|
|
|
- // if (res.status === 200) {
|
|
|
- // const x = res.result.map((item: any) => item.data.timeString).reverse();
|
|
|
- // const y = res.result.map((item: any) => item.data.value).reverse();
|
|
|
- // setOptions({
|
|
|
- // xAxis: {
|
|
|
- // type: 'category',
|
|
|
- // boundaryGap: false,
|
|
|
- // data: x,
|
|
|
- // },
|
|
|
- // yAxis: {
|
|
|
- // type: 'value',
|
|
|
- // },
|
|
|
- // tooltip: {
|
|
|
- // trigger: 'axis',
|
|
|
- // },
|
|
|
- // grid: {
|
|
|
- // top: '2%',
|
|
|
- // bottom: '5%',
|
|
|
- // left: '2%',
|
|
|
- // right: '2%',
|
|
|
- // },
|
|
|
- // series: [
|
|
|
- // {
|
|
|
- // name: '消息量',
|
|
|
- // data: y,
|
|
|
- // type: 'line',
|
|
|
- // smooth: true,
|
|
|
- // color: '#685DEB',
|
|
|
- // areaStyle: {
|
|
|
- // color: {
|
|
|
- // type: 'linear',
|
|
|
- // x: 0,
|
|
|
- // y: 0,
|
|
|
- // x2: 0,
|
|
|
- // y2: 1,
|
|
|
- // colorStops: [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: '#685DEB', // 100% 处的颜色
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 1,
|
|
|
- // color: '#FFFFFF', // 0% 处的颜色
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // global: false, // 缺省为 false
|
|
|
- // },
|
|
|
- // },
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
};
|
|
|
//地图数据
|
|
|
const geo = async (data?: any) => {
|