ui: Fix tooltip date formatting.

With the migration from moment to date-fns (#460) some of the formatting
strings were not updated accordingly.

Fixes #503.
This commit is contained in:
Orne Brocaar 2024-08-28 14:40:22 +01:00
parent e63296573b
commit d69a0eee75

View File

@ -15,16 +15,16 @@ interface IProps {
function MetricChart(props: IProps) {
let unit: TimeUnit = "hour";
let tooltipFormat = "LT";
let tooltipFormat = "p";
if (props.aggregation === Aggregation.DAY) {
unit = "day";
tooltipFormat = "MMM Do";
tooltipFormat = "MMM d";
} else if (props.aggregation === Aggregation.MONTH) {
unit = "month";
tooltipFormat = "MMM YYYY";
tooltipFormat = "MMM yyyy";
} else if (props.aggregation === Aggregation.MINUTE) {
unit = "minute";
tooltipFormat = "LT";
tooltipFormat = "p";
}
const animation = false as const;
@ -59,8 +59,6 @@ function MetricChart(props: IProps) {
.sort((a, b) => a.getLabel().localeCompare(b.getLabel()))
.map((v, i) => {
const colors = palette("cb-Paired", props.metric.getDatasetsList().length).map((hex: string) => "#" + hex);
console.log(v.getLabel());
console.log(colors[i]);
return {
label: v.getLabel(),