From f492225cb3f799bb8d5f2cff3677a94044b39e68 Mon Sep 17 00:00:00 2001 From: Bruce CHEN <805899926@qq.com> Date: Mon, 11 Mar 2024 12:52:13 +0800 Subject: [PATCH] # day stat --- src/view/cf-best/cdn/Stat.tsx | 56 +++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/src/view/cf-best/cdn/Stat.tsx b/src/view/cf-best/cdn/Stat.tsx index 9944e76..53d9f1b 100644 --- a/src/view/cf-best/cdn/Stat.tsx +++ b/src/view/cf-best/cdn/Stat.tsx @@ -1,24 +1,65 @@ import React, {useRef} from 'react'; import * as echarts from 'echarts'; import stub from "@/init"; +import {Col, Row} from 'antd'; const CFBestCDNStat: React.FC = () => { + const dayStatRef = useRef(null) const todayStatRef = useRef(null) stub.ref.react.useEffect(() => { - const chart = echarts.init(todayStatRef.current) + const dayChart = echarts.init(dayStatRef.current) + const todayChart = echarts.init(todayStatRef.current) + stub.api.get("cf-best/cdn/getDayCountry").then((t: any) => { + dayChart.setOption({ + title: { + text: '往日IP数' + }, + tooltip: { + trigger: 'axis', + position: ['100%', "0"] + }, + legend: { + top: '10%', + left: 'center', + data: t?.data.data.series.map((p: any) => p.name) + }, + grid: { + top: "30%", + left: '2%', + right: '2%', + bottom: '2%', + containLabel: true + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: t?.data.data.days + }, + yAxis: { + type: 'value', + }, + series: t?.data.data.series.map((p: any) => { + return {...p, type: "line", stack: 'Total'} + }) + }) + }) stub.api.get("cf-best/cdn/getAggCountry").then((t: any) => { - chart.setOption({ + todayChart.setOption({ + title: { + text: "今日IP数" + }, tooltip: { trigger: 'item' }, legend: { - top: '5%', + top: '10%', left: 'center' }, series: [ { type: 'pie', - radius: ['50%', '70%'], + top: "30%", + radius: ['50%', '100%'], avoidLabelOverlap: false, label: { show: false, @@ -40,6 +81,11 @@ const CFBestCDNStat: React.FC = () => { }) }) }, []) - return (
) + return ( + + + + + ) }; export default CFBestCDNStat; \ No newline at end of file