style: gauge dark style
This commit is contained in:
@@ -31,13 +31,16 @@ export default function useChartConfig() {
|
|||||||
const { useToken } = theme;
|
const { useToken } = theme;
|
||||||
const { token } = useToken();
|
const { token } = useToken();
|
||||||
|
|
||||||
|
console.log('token:', token);
|
||||||
|
|
||||||
const chartColorMap = useMemo(() => {
|
const chartColorMap = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
titleColor: token.colorText,
|
titleColor: token.colorText,
|
||||||
splitLineColor: token.colorBorder,
|
splitLineColor: token.colorBorder,
|
||||||
tickLineColor: token.colorSplit,
|
tickLineColor: token.colorSplit,
|
||||||
axislabelColor: token.colorTextTertiary,
|
axislabelColor: token.colorTextTertiary,
|
||||||
gaugeSplitLineColor: isDarkTheme ? '#b8b8b8' : 'rgba(255, 255, 255, 1)',
|
gaugeBgColor: token.colorFillSecondary,
|
||||||
|
gaugeSplitLineColor: isDarkTheme ? '#ccc' : 'rgba(255, 255, 255, 1)',
|
||||||
colorBgContainerHover: isDarkTheme ? '#424242' : '#fff'
|
colorBgContainerHover: isDarkTheme ? '#424242' : '#fff'
|
||||||
};
|
};
|
||||||
}, [userSettings.theme, isDarkTheme]);
|
}, [userSettings.theme, isDarkTheme]);
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import { ChartProps } from './types';
|
|||||||
const GaugeChart: React.FC<Omit<ChartProps, 'seriesData' | 'xAxisData'>> = (
|
const GaugeChart: React.FC<Omit<ChartProps, 'seriesData' | 'xAxisData'>> = (
|
||||||
props
|
props
|
||||||
) => {
|
) => {
|
||||||
const { gaugeItemConfig, title: titleConfig } = useChartConfig();
|
const {
|
||||||
|
gaugeItemConfig,
|
||||||
|
title: titleConfig,
|
||||||
|
chartColorMap
|
||||||
|
} = useChartConfig();
|
||||||
const { value, height, width, labelFormatter, title, color } = props;
|
const { value, height, width, labelFormatter, title, color } = props;
|
||||||
if (!value && value !== 0) {
|
if (!value && value !== 0) {
|
||||||
return <EmptyData height={height} title={title}></EmptyData>;
|
return <EmptyData height={height} title={title}></EmptyData>;
|
||||||
@@ -30,7 +34,7 @@ const GaugeChart: React.FC<Omit<ChartProps, 'seriesData' | 'xAxisData'>> = (
|
|||||||
...gaugeItemConfig.axisLine.lineStyle,
|
...gaugeItemConfig.axisLine.lineStyle,
|
||||||
color: [
|
color: [
|
||||||
[value / 100, color],
|
[value / 100, color],
|
||||||
[1, 'rgba(221, 221, 221, 0.5)']
|
[1, chartColorMap.gaugeBgColor]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user