fix min date chart bug when using all time

This commit is contained in:
Francis Cao 2024-11-27 10:38:45 -08:00
parent bf89dfdd49
commit c851f3bb3c
4 changed files with 19 additions and 7 deletions

View file

@ -14,6 +14,7 @@ export interface BarChartProps extends ChartProps {
YAxisType?: string;
minDate?: number | string;
maxDate?: number | string;
isAllTime?: boolean;
}
export function BarChart(props: BarChartProps) {
@ -29,6 +30,7 @@ export function BarChart(props: BarChartProps) {
minDate,
maxDate,
currency,
isAllTime,
} = props;
const options: any = useMemo(() => {
@ -37,7 +39,7 @@ export function BarChart(props: BarChartProps) {
x: {
type: XAxisType,
stacked: true,
min: minDate && new Date(minDate).getSeconds() === 0 ? minDate : '',
min: isAllTime ? '' : minDate,
max: maxDate,
time: {
unit,