0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

feat(console): update dashboard chart y-axis tick format (#1590)

This commit is contained in:
Xiao Yijun 2022-07-18 20:18:01 +08:00 committed by GitHub
parent b04be8ada5
commit 951c6fa9a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,11 @@ const tickStyle = {
fontFamily: 'var(--font-family)',
};
const tickFormatter = new Intl.NumberFormat('en-US', {
maximumFractionDigits: 1,
notation: 'compact',
});
const Dashboard = () => {
const [date, setDate] = useState<string>(dayjs().format('YYYY-MM-DD'));
const { data: totalData, error: totalError } = useSWR<TotalUsersResponse, RequestError>(
@ -111,11 +116,11 @@ const Dashboard = () => {
/>
<XAxis dataKey="date" tickLine={false} tick={tickStyle} />
<YAxis
orientation="right"
width={30}
width={35}
axisLine={false}
tickLine={false}
tick={tickStyle}
tickFormatter={(tick) => tickFormatter.format(tick).toLowerCase()}
/>
<Tooltip content={<ChartTooltip />} cursor={{ stroke: 'var(--color-primary' }} />
</AreaChart>