Skip to content

Commit

Permalink
# day stat
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 committed Mar 11, 2024
1 parent 13ba8f3 commit f492225
Showing 1 changed file with 51 additions and 5 deletions.
56 changes: 51 additions & 5 deletions src/view/cf-best/cdn/Stat.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -40,6 +81,11 @@ const CFBestCDNStat: React.FC = () => {
})
})
}, [])
return (<div style={{width: "100%", height: "300px"}} ref={todayStatRef}/>)
return (
<Row gutter={[16, 16]} style={{height: "300px"}}>
<Col span={12} ref={dayStatRef}/>
<Col span={12} ref={todayStatRef}/>
</Row>
)
};
export default CFBestCDNStat;

0 comments on commit f492225

Please sign in to comment.