Hide xaxis label overlapping - Show current day/month/year below the chart for self better self containing overview
This commit is contained in:
@@ -25,4 +25,26 @@ export const formatterXAxis = (
|
||||
case '3y':
|
||||
return date.toLocaleDateString(locale, { year: 'numeric', month: 'short', day: 'numeric' });
|
||||
}
|
||||
};
|
||||
|
||||
export const formatterXAxisLabel = (
|
||||
locale: string,
|
||||
windowPreference: string,
|
||||
) => {
|
||||
const date = new Date();
|
||||
switch (windowPreference) {
|
||||
case '2h':
|
||||
case '24h':
|
||||
return date.toLocaleDateString(locale, { year: 'numeric', month: 'short', day: 'numeric' });
|
||||
case '1w':
|
||||
return date.toLocaleDateString(locale, { year: 'numeric', month: 'long' });
|
||||
case '1m':
|
||||
case '3m':
|
||||
case '6m':
|
||||
return date.toLocaleDateString(locale, { year: 'numeric' });
|
||||
case '1y':
|
||||
case '2y':
|
||||
case '3y':
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user