mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
Update chart tooltip.
This commit is contained in:
parent
0d4a2e2a0e
commit
38ec91c48e
@ -44,9 +44,9 @@ export default function BarChart({
|
||||
return dateFormat(d, 'EEE M/d', locale);
|
||||
case 'month':
|
||||
if (w <= 660) {
|
||||
return dateFormat(d, 'MMM', locale);
|
||||
return index % 2 === 0 ? dateFormat(d, 'MMM', locale) : '';
|
||||
}
|
||||
return dateFormat(d, 'MMMM', locale);
|
||||
return dateFormat(d, 'MMM', locale);
|
||||
default:
|
||||
return label;
|
||||
}
|
||||
@ -65,7 +65,7 @@ export default function BarChart({
|
||||
const [label, value] = body[0].lines[0].split(':');
|
||||
|
||||
setTooltip({
|
||||
title: dateFormat(new Date(+title[0]), 'EEE MMMM d yyyy', locale),
|
||||
title: dateFormat(new Date(+title[0]), getTooltipFormat(unit), locale),
|
||||
value,
|
||||
label,
|
||||
labelColor: labelColors[0].backgroundColor,
|
||||
@ -73,6 +73,15 @@ export default function BarChart({
|
||||
}
|
||||
}
|
||||
|
||||
function getTooltipFormat(unit) {
|
||||
switch (unit) {
|
||||
case 'hour':
|
||||
return 'EEE ha — MMM d yyyy';
|
||||
default:
|
||||
return 'EEE MMMM d yyyy';
|
||||
}
|
||||
}
|
||||
|
||||
function createChart() {
|
||||
const options = {
|
||||
animation: {
|
||||
|
@ -2,7 +2,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-width: 120px;
|
||||
min-width: 140px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user