Wizard: Add annotation for current date

This adds a line annotation to mark the current date.
This commit is contained in:
regexowl 2023-12-06 11:21:20 +01:00 committed by Lucas Garfield
parent 51f68bda34
commit f6d1b12b3c

View file

@ -12,6 +12,7 @@ import {
} from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { Chart, registerables } from 'chart.js';
import annotationPlugin from 'chartjs-plugin-annotation';
import { Bar } from 'react-chartjs-2';
import {
@ -26,8 +27,11 @@ import {
import 'chartjs-adapter-moment';
import { toMonthAndYear } from '../../../Utilities/time';
Chart.register(annotationPlugin);
Chart.register(...registerables);
const currentDate = new Date().toString();
export const chartMajorVersionCfg = {
data: {
labels: ['RHEL 9', 'RHEL 8'],
@ -87,6 +91,18 @@ export const chartMajorVersionCfg = {
legend: {
position: 'bottom' as const,
},
annotation: {
annotations: {
today: {
type: 'line' as const,
xMin: currentDate,
xMax: currentDate,
borderColor: 'black',
borderWidth: 2,
borderDash: [8, 2],
},
},
},
},
},
};