All checks were successful
Docker Build and Push / build-image (push) Successful in 16m11s
473 lines
20 KiB
JavaScript
473 lines
20 KiB
JavaScript
import { useState } from 'react'
|
||
import Head from 'next/head'
|
||
import Navbar from '../components/Navbar'
|
||
import Footer from '../components/Footer'
|
||
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'
|
||
|
||
const chinaBondData = [
|
||
{ month: '2024-01', oneYear: 1.85, fiveYear: 2.45, tenYear: 2.65 },
|
||
{ month: '2024-02', oneYear: 1.82, fiveYear: 2.42, tenYear: 2.62 },
|
||
{ month: '2024-03', oneYear: 1.78, fiveYear: 2.38, tenYear: 2.58 },
|
||
{ month: '2024-04', oneYear: 1.75, fiveYear: 2.35, tenYear: 2.55 },
|
||
{ month: '2024-05', oneYear: 1.72, fiveYear: 2.32, tenYear: 2.52 },
|
||
{ month: '2024-06', oneYear: 1.68, fiveYear: 2.28, tenYear: 2.48 },
|
||
{ month: '2024-07', oneYear: 1.65, fiveYear: 2.25, tenYear: 2.45 },
|
||
{ month: '2024-08', oneYear: 1.62, fiveYear: 2.22, tenYear: 2.42 },
|
||
{ month: '2024-09', oneYear: 1.58, fiveYear: 2.18, tenYear: 2.38 },
|
||
{ month: '2024-10', oneYear: 1.55, fiveYear: 2.15, tenYear: 2.35 },
|
||
{ month: '2024-11', oneYear: 1.52, fiveYear: 2.12, tenYear: 2.32 },
|
||
{ month: '2024-12', oneYear: 1.48, fiveYear: 2.08, tenYear: 2.28 }
|
||
]
|
||
|
||
const usBondData = [
|
||
{ month: '2024-01', oneYear: 4.85, fiveYear: 4.25, tenYear: 3.95 },
|
||
{ month: '2024-02', oneYear: 4.82, fiveYear: 4.22, tenYear: 3.92 },
|
||
{ month: '2024-03', oneYear: 4.78, fiveYear: 4.18, tenYear: 3.88 },
|
||
{ month: '2024-04', oneYear: 4.65, fiveYear: 4.05, tenYear: 3.75 },
|
||
{ month: '2024-05', oneYear: 4.55, fiveYear: 3.95, tenYear: 3.65 },
|
||
{ month: '2024-06', oneYear: 4.45, fiveYear: 3.85, tenYear: 3.55 },
|
||
{ month: '2024-07', oneYear: 4.35, fiveYear: 3.75, tenYear: 3.45 },
|
||
{ month: '2024-08', oneYear: 4.25, fiveYear: 3.65, tenYear: 3.35 },
|
||
{ month: '2024-09', oneYear: 4.15, fiveYear: 3.55, tenYear: 3.25 },
|
||
{ month: '2024-10', oneYear: 4.05, fiveYear: 3.45, tenYear: 3.15 },
|
||
{ month: '2024-11', oneYear: 3.95, fiveYear: 3.35, tenYear: 3.05 },
|
||
{ month: '2024-12', oneYear: 3.85, fiveYear: 3.25, tenYear: 2.95 }
|
||
]
|
||
|
||
const chinaLPRData = [
|
||
{ month: '2024-01', oneYear: 3.45, fiveYear: 3.95 },
|
||
{ month: '2024-02', oneYear: 3.45, fiveYear: 3.95 },
|
||
{ month: '2024-03', oneYear: 3.45, fiveYear: 3.95 },
|
||
{ month: '2024-04', oneYear: 3.40, fiveYear: 3.90 },
|
||
{ month: '2024-05', oneYear: 3.40, fiveYear: 3.90 },
|
||
{ month: '2024-06', oneYear: 3.40, fiveYear: 3.90 },
|
||
{ month: '2024-07', oneYear: 3.35, fiveYear: 3.85 },
|
||
{ month: '2024-08', oneYear: 3.35, fiveYear: 3.85 },
|
||
{ month: '2024-09', oneYear: 3.35, fiveYear: 3.85 },
|
||
{ month: '2024-10', oneYear: 3.30, fiveYear: 3.80 },
|
||
{ month: '2024-11', oneYear: 3.30, fiveYear: 3.80 },
|
||
{ month: '2024-12', oneYear: 3.30, fiveYear: 3.80 }
|
||
]
|
||
|
||
// 中国黄金储备月度数据(单位:吨)
|
||
const chinaGoldReserveMonthly = [
|
||
{ month: '2024-01', reserves: 2245.4 },
|
||
{ month: '2024-02', reserves: 2255.2 },
|
||
{ month: '2024-03', reserves: 2267.5 },
|
||
{ month: '2024-04', reserves: 2276.9 },
|
||
{ month: '2024-05', reserves: 2285.3 },
|
||
{ month: '2024-06', reserves: 2296.1 },
|
||
{ month: '2024-07', reserves: 2305.8 },
|
||
{ month: '2024-08', reserves: 2316.2 },
|
||
{ month: '2024-09', reserves: 2325.7 },
|
||
{ month: '2024-10', reserves: 2336.5 },
|
||
{ month: '2024-11', reserves: 2345.9 },
|
||
{ month: '2024-12', reserves: 2356.3 }
|
||
]
|
||
|
||
// 美国黄金储备月度数据(单位:吨)
|
||
const usGoldReserveMonthly = [
|
||
{ month: '2024-01', reserves: 8133.5 },
|
||
{ month: '2024-02', reserves: 8133.5 },
|
||
{ month: '2024-03', reserves: 8133.5 },
|
||
{ month: '2024-04', reserves: 8133.5 },
|
||
{ month: '2024-05', reserves: 8133.5 },
|
||
{ month: '2024-06', reserves: 8133.5 },
|
||
{ month: '2024-07', reserves: 8133.5 },
|
||
{ month: '2024-08', reserves: 8133.5 },
|
||
{ month: '2024-09', reserves: 8133.5 },
|
||
{ month: '2024-10', reserves: 8133.5 },
|
||
{ month: '2024-11', reserves: 8133.5 },
|
||
{ month: '2024-12', reserves: 8133.5 }
|
||
]
|
||
|
||
// 中国黄金储备年度数据(单位:吨)
|
||
const chinaGoldReserveYearly = [
|
||
{ year: '2019', reserves: 1948.3 },
|
||
{ year: '2020', reserves: 1948.3 },
|
||
{ year: '2021', reserves: 1948.3 },
|
||
{ year: '2022', reserves: 1948.3 },
|
||
{ year: '2023', reserves: 2190.2 },
|
||
{ year: '2024', reserves: 2356.3 }
|
||
]
|
||
|
||
// 美国黄金储备年度数据(单位:吨)
|
||
const usGoldReserveYearly = [
|
||
{ year: '2019', reserves: 8133.5 },
|
||
{ year: '2020', reserves: 8133.5 },
|
||
{ year: '2021', reserves: 8133.5 },
|
||
{ year: '2022', reserves: 8133.5 },
|
||
{ year: '2023', reserves: 8133.5 },
|
||
{ year: '2024', reserves: 8133.5 }
|
||
]
|
||
|
||
export default function Data() {
|
||
const [selectedIndicator, setSelectedIndicator] = useState('bond-china-treasury')
|
||
|
||
const indicators = [
|
||
{
|
||
group: '债券',
|
||
items: [
|
||
{ id: 'bond-china-treasury', name: '中国国债' },
|
||
{ id: 'bond-us-treasury', name: '美国国债' }
|
||
]
|
||
},
|
||
{
|
||
group: '贷款',
|
||
items: [
|
||
{ id: 'loan-china-lpr', name: '中国LPR' }
|
||
]
|
||
},
|
||
{
|
||
group: '央行数据',
|
||
items: [
|
||
{ id: 'central-bank-china-gold-monthly', name: '中国黄金储备(月)' },
|
||
{ id: 'central-bank-us-gold-monthly', name: '美国黄金储备(月)' },
|
||
{ id: 'central-bank-china-gold-yearly', name: '中国黄金储备(年)' },
|
||
{ id: 'central-bank-us-gold-yearly', name: '美国黄金储备(年)' }
|
||
]
|
||
}
|
||
]
|
||
|
||
return (
|
||
<div className="container">
|
||
<Head>
|
||
<title>数据 - iBoard</title>
|
||
<link rel="icon" href="/favicon.ico" />
|
||
</Head>
|
||
|
||
<Navbar />
|
||
|
||
<main>
|
||
<h1 className="title">
|
||
经济数据
|
||
</h1>
|
||
|
||
<p className="description">
|
||
各种经济数据和图表
|
||
</p>
|
||
|
||
<div className="data-layout">
|
||
<div className="data-sidebar">
|
||
{indicators.map((group, groupIndex) => (
|
||
<div key={groupIndex} className="indicator-group">
|
||
<h3 className="group-title">{group.group}</h3>
|
||
<ul className="indicator-list">
|
||
{group.items.map((item) => (
|
||
<li
|
||
key={item.id}
|
||
className={`indicator-item ${selectedIndicator === item.id ? 'active' : ''}`}
|
||
onClick={() => setSelectedIndicator(item.id)}
|
||
>
|
||
{item.name}
|
||
</li>
|
||
))}
|
||
</ul>
|
||
</div>
|
||
))}
|
||
</div>
|
||
|
||
<div className="data-content">
|
||
{selectedIndicator === 'bond-china-treasury' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">中国国债收益率走势</h2>
|
||
<p className="indicator-description">展示一年期、五年期、十年期国债收益率的变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={chinaBondData} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="month" />
|
||
<YAxis domain={['dataMin - 0.2', 'dataMax + 0.2']} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="oneYear" name="一年期" stroke="#8884d8" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
<Line type="monotone" dataKey="fiveYear" name="五年期" stroke="#82ca9d" strokeWidth={2} />
|
||
<Line type="monotone" dataKey="tenYear" name="十年期" stroke="#ffc658" strokeWidth={2} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>月份</th>
|
||
<th>一年期(%)</th>
|
||
<th>五年期(%)</th>
|
||
<th>十年期(%)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{chinaBondData.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.month}</td>
|
||
<td>{row.oneYear.toFixed(2)}</td>
|
||
<td>{row.fiveYear.toFixed(2)}</td>
|
||
<td>{row.tenYear.toFixed(2)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{selectedIndicator === 'bond-us-treasury' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">美国国债收益率走势</h2>
|
||
<p className="indicator-description">展示一年期、五年期、十年期国债收益率的变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={usBondData} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="month" />
|
||
<YAxis domain={['dataMin - 0.2', 'dataMax + 0.2']} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="oneYear" name="一年期" stroke="#ff7300" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
<Line type="monotone" dataKey="fiveYear" name="五年期" stroke="#0088fe" strokeWidth={2} />
|
||
<Line type="monotone" dataKey="tenYear" name="十年期" stroke="#00C49F" strokeWidth={2} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>月份</th>
|
||
<th>一年期(%)</th>
|
||
<th>五年期(%)</th>
|
||
<th>十年期(%)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{usBondData.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.month}</td>
|
||
<td>{row.oneYear.toFixed(2)}</td>
|
||
<td>{row.fiveYear.toFixed(2)}</td>
|
||
<td>{row.tenYear.toFixed(2)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{selectedIndicator === 'loan-china-lpr' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">中国LPR走势</h2>
|
||
<p className="indicator-description">展示一年期和五年期贷款市场报价利率(LPR)的变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={chinaLPRData} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="month" />
|
||
<YAxis domain={['dataMin - 0.2', 'dataMax + 0.2']} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="oneYear" name="一年期LPR" stroke="#e6194b" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
<Line type="monotone" dataKey="fiveYear" name="五年期LPR" stroke="#3cb44b" strokeWidth={2} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>月份</th>
|
||
<th>一年期LPR(%)</th>
|
||
<th>五年期LPR(%)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{chinaLPRData.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.month}</td>
|
||
<td>{row.oneYear.toFixed(2)}</td>
|
||
<td>{row.fiveYear.toFixed(2)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{selectedIndicator === 'central-bank-china-gold-monthly' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">中国黄金储备(月度)</h2>
|
||
<p className="indicator-description">展示中国央行黄金储备的月度变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={chinaGoldReserveMonthly} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="month" />
|
||
<YAxis domain={['dataMin - 20', 'dataMax + 20']} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="reserves" name="黄金储备(吨)" stroke="#ffd700" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>月份</th>
|
||
<th>黄金储备(吨)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{chinaGoldReserveMonthly.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.month}</td>
|
||
<td>{row.reserves.toFixed(1)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{selectedIndicator === 'central-bank-us-gold-monthly' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">美国黄金储备(月度)</h2>
|
||
<p className="indicator-description">展示美国央行黄金储备的月度变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={usGoldReserveMonthly} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="month" />
|
||
<YAxis domain={[8130, 8140]} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="reserves" name="黄金储备(吨)" stroke="#333333" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>月份</th>
|
||
<th>黄金储备(吨)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{usGoldReserveMonthly.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.month}</td>
|
||
<td>{row.reserves.toFixed(1)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{selectedIndicator === 'central-bank-china-gold-yearly' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">中国黄金储备(年度)</h2>
|
||
<p className="indicator-description">展示中国央行黄金储备的年度变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={chinaGoldReserveYearly} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="year" />
|
||
<YAxis domain={['dataMin - 50', 'dataMax + 50']} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="reserves" name="黄金储备(吨)" stroke="#ffd700" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>年份</th>
|
||
<th>黄金储备(吨)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{chinaGoldReserveYearly.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.year}</td>
|
||
<td>{row.reserves.toFixed(1)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{selectedIndicator === 'central-bank-us-gold-yearly' && (
|
||
<div className="indicator-detail">
|
||
<h2 className="indicator-title">美国黄金储备(年度)</h2>
|
||
<p className="indicator-description">展示美国央行黄金储备的年度变化趋势</p>
|
||
|
||
<div className="chart-container">
|
||
<ResponsiveContainer width="100%" height={500}>
|
||
<LineChart data={usGoldReserveYearly} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
|
||
<CartesianGrid strokeDasharray="3 3" />
|
||
<XAxis dataKey="year" />
|
||
<YAxis domain={[8130, 8140]} />
|
||
<Tooltip />
|
||
<Legend />
|
||
<Line type="monotone" dataKey="reserves" name="黄金储备(吨)" stroke="#333333" strokeWidth={2} activeDot={{ r: 8 }} />
|
||
</LineChart>
|
||
</ResponsiveContainer>
|
||
</div>
|
||
|
||
<div className="data-table-container">
|
||
<h3 className="table-title">详细数据</h3>
|
||
<table className="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>年份</th>
|
||
<th>黄金储备(吨)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{usGoldReserveYearly.map((row, index) => (
|
||
<tr key={index}>
|
||
<td>{row.year}</td>
|
||
<td>{row.reserves.toFixed(1)}</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
)}
|
||
</div>
|
||
</div>
|
||
</main>
|
||
|
||
<Footer />
|
||
</div>
|
||
)
|
||
}
|