fix: dashboard intl settings
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Column } from '@ant-design/plots';
|
||||
|
||||
import EmptyData from './empty-data';
|
||||
|
||||
interface BarChartProps {
|
||||
data: any[];
|
||||
xField: string;
|
||||
@@ -99,7 +101,11 @@ const BarChart: React.FC<BarChartProps> = (props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Column {...config} />
|
||||
{data.length > 0 ? (
|
||||
<Column {...config} />
|
||||
) : (
|
||||
<EmptyData height={height} title={title} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Empty } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
const EmptyData: React.FC<{
|
||||
height: string | number;
|
||||
title: React.ReactNode;
|
||||
}> = ({ height, title }) => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: height || '100%'
|
||||
}}
|
||||
className="flex-center flex-column "
|
||||
>
|
||||
<h3
|
||||
className="justify-center"
|
||||
style={{ padding: '16px 0', marginBottom: 0 }}
|
||||
>
|
||||
{title}
|
||||
</h3>
|
||||
<div
|
||||
className="flex-center justify-center flex-column"
|
||||
style={{ height: '100%' }}
|
||||
>
|
||||
<Empty />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EmptyData;
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Bar } from '@ant-design/plots';
|
||||
import EmptyData from './empty-data';
|
||||
|
||||
interface BarChartProps {
|
||||
data: any[];
|
||||
@@ -11,6 +12,7 @@ interface BarChartProps {
|
||||
seriesField?: string;
|
||||
stack?: boolean;
|
||||
legend?: any;
|
||||
showYAxis?: boolean;
|
||||
}
|
||||
const BarChart: React.FC<BarChartProps> = (props) => {
|
||||
const {
|
||||
@@ -23,6 +25,7 @@ const BarChart: React.FC<BarChartProps> = (props) => {
|
||||
colorField,
|
||||
seriesField,
|
||||
stack,
|
||||
showYAxis = true,
|
||||
legend = undefined
|
||||
} = props;
|
||||
const config = {
|
||||
@@ -57,9 +60,11 @@ const BarChart: React.FC<BarChartProps> = (props) => {
|
||||
xAxis: true,
|
||||
tick: false
|
||||
},
|
||||
y: {
|
||||
tick: false
|
||||
}
|
||||
y: showYAxis
|
||||
? {
|
||||
tick: false
|
||||
}
|
||||
: null
|
||||
},
|
||||
title: {
|
||||
title,
|
||||
@@ -94,7 +99,11 @@ const BarChart: React.FC<BarChartProps> = (props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Bar {...config} />
|
||||
{data.length === 0 ? (
|
||||
<EmptyData height={height} title={title} />
|
||||
) : (
|
||||
<Bar {...config} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -7,12 +7,22 @@ interface LineChartProps {
|
||||
color?: string[];
|
||||
xField?: string;
|
||||
yField?: string;
|
||||
locale: string;
|
||||
labelFormatter?: (v: any) => string;
|
||||
slider?: any;
|
||||
}
|
||||
const LineChart: React.FC<LineChartProps> = (props) => {
|
||||
const { data, title, color, xField, yField, slider, height, labelFormatter } =
|
||||
props;
|
||||
const {
|
||||
data,
|
||||
title,
|
||||
color,
|
||||
xField,
|
||||
locale,
|
||||
yField,
|
||||
slider,
|
||||
height,
|
||||
labelFormatter
|
||||
} = props;
|
||||
const config = {
|
||||
title,
|
||||
height,
|
||||
@@ -56,6 +66,7 @@ const LineChart: React.FC<LineChartProps> = (props) => {
|
||||
color: {
|
||||
layout: { justifyContent: 'center' }
|
||||
},
|
||||
|
||||
size: {
|
||||
itemLabelFontSize: 14,
|
||||
itemLabelFontWeight: 500
|
||||
|
||||
@@ -16,7 +16,7 @@ const UitilBar: React.FC<UitilBarProps> = (props) => {
|
||||
percent,
|
||||
steps = 10,
|
||||
gapDegree = 170,
|
||||
strokeWidth = 12,
|
||||
strokeWidth = 10,
|
||||
title,
|
||||
size = 160,
|
||||
strokeColor,
|
||||
|
||||
Reference in New Issue
Block a user