From eab7d9c77fef8ee929f922c37ae9c9094b80c13e Mon Sep 17 00:00:00 2001 From: jialin Date: Sat, 6 Jun 2026 13:02:23 +0800 Subject: [PATCH] style: usage chart --- src/pages/_components/bar-chart/index.tsx | 2 +- src/pages/_components/pie-chart/index.tsx | 17 +++++++++++++++-- src/pages/usage/components/summary-tab.tsx | 13 +++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/pages/_components/bar-chart/index.tsx b/src/pages/_components/bar-chart/index.tsx index 235e4f57..5e08c73d 100644 --- a/src/pages/_components/bar-chart/index.tsx +++ b/src/pages/_components/bar-chart/index.tsx @@ -126,7 +126,7 @@ const BarChart: React.FC = (props) => { left: 0, right: 0, top: title ? 30 : 10, - bottom: 28, + bottom: 0, containLabel: true }, tooltip: { diff --git a/src/pages/_components/pie-chart/index.tsx b/src/pages/_components/pie-chart/index.tsx index 26f6001a..7e311b94 100644 --- a/src/pages/_components/pie-chart/index.tsx +++ b/src/pages/_components/pie-chart/index.tsx @@ -45,12 +45,20 @@ const PieChart: React.FC = ({ const options = useMemo( () => ({ color: colors, + grid: { + left: 0, + right: 0, + top: 0, + bottom: 0, + containLabel: true + }, tooltip: { trigger: 'item', + position: 'top', // Keep the tooltip inside the chart box — the donut sits on the left, so // a left-slice tooltip could otherwise spill out and get hidden behind // the side menu. - confine: true, + confine: false, backgroundColor: token.colorBgElevated, borderColor: 'transparent', formatter: (params: any) => { @@ -97,7 +105,12 @@ const PieChart: React.FC = ({ // No on-arc label — the percentage lives in the tooltip instead, so // hovering shows value + percent in one place. label: { show: false }, - emphasis: { label: { show: false }, scale: false }, + emphasis: { + label: { + show: false + }, + scale: true + }, labelLine: { show: false }, data } diff --git a/src/pages/usage/components/summary-tab.tsx b/src/pages/usage/components/summary-tab.tsx index 3fe3f6e3..a85213fe 100644 --- a/src/pages/usage/components/summary-tab.tsx +++ b/src/pages/usage/components/summary-tab.tsx @@ -25,8 +25,9 @@ import useCoolColors from '@/hooks/use-cool-colors'; import BarChart from '@/pages/_components/bar-chart'; import PieChart from '@/pages/_components/pie-chart'; import { formatLargeNumber } from '@/utils'; +import { CardWrapper } from '@gpustack/core-ui'; import { useAccess, useIntl } from '@umijs/max'; -import { Card, Col, Empty, Row } from 'antd'; +import { Col, Empty, Row } from 'antd'; import dayjs from 'dayjs'; import React, { useEffect, useMemo, useState } from 'react'; import { queryUsageTimeSeriesData } from '../apis'; @@ -128,7 +129,7 @@ const DomainSection: React.FC<{ /> ); return ( - +
@@ -195,7 +196,7 @@ const DomainSection: React.FC<{ )}
-
+ ); }; @@ -384,9 +385,9 @@ const SummaryTab: React.FC = () => { onUsersChange={setSelectedUsers} onRefresh={() => setRefreshKey((k) => k + 1)} /> -
+
- +