Skip to content

Fixes #39070 - Update AreaChart to PatternFly5#10803

Open
tlabaj wants to merge 1 commit intotheforeman:developfrom
tlabaj:areachart
Open

Fixes #39070 - Update AreaChart to PatternFly5#10803
tlabaj wants to merge 1 commit intotheforeman:developfrom
tlabaj:areachart

Conversation

@tlabaj
Copy link
Copy Markdown
Contributor

@tlabaj tlabaj commented Dec 17, 2025

Fixes: #39070

This PR updates the Area Chart to use PF5 components.

New images after latest Updates

Before:

image

After:

image

@github-actions github-actions bot added the UI label Dec 17, 2025
@tlabaj tlabaj changed the title WIP: Update Area chart to PF5 Fixes #39070 - Update AreaChart to PatternFly5 Feb 10, 2026
@tlabaj tlabaj marked this pull request as ready for review February 10, 2026 15:34
@tlabaj tlabaj force-pushed the areachart branch 4 times, most recently from f0cc83c to d891a09 Compare February 10, 2026 16:26
Copy link
Copy Markdown
Contributor

@kmalyjur kmalyjur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving an initial review, I might comment more tomorrow.


return (
<div style={{ height: chartHeight, width: chartWidth || '100%' }}>
<Chart
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the chart fill the entire width of the card?

legendData={legendData}
legendOrientation="horizontal"
legendPosition="bottom"
legendComponent={<ChartLegend />}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old chart has clickable legend text, it would be nice to have it in the new one, too.

Comment on lines +151 to +153
<ChartAxis
tickFormat={t => {
if (config === 'timeseries' && t instanceof Date) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config === 'timeseries' can be removed since the data transformation always creates Date objects anyway.

Suggested change
<ChartAxis
tickFormat={t => {
if (config === 'timeseries' && t instanceof Date) {
<ChartAxis
tickFormat={t => {
if (t instanceof Date) {

expect(chartWrapper).toHaveStyle({ height: '300px', width: '500px' });
});

it('renders with onclick callback', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test checks if the chart renders, but it does not verify if the callback actually triggers when clicked.

Copy link
Copy Markdown
Contributor

@kmalyjur kmalyjur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how I see before and after:
Image
Image

Comment on lines +60 to +67
const handleClick = useMemo(
() => (event, datum) => {
if (onclick && datum && datum.name) {
onclick({ id: datum.name });
}
},
[onclick]
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function is broken or not called.

}

const timestamps = timeColumn.slice(1);
const dates = timestamps.map(epochSecs => new Date(epochSecs * 1000));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The axis shows raw numbers (like "17709"). There could be a check if the backend is already sending milliseconds, and if so, it shouldn't use * 1000.

@tlabaj
Copy link
Copy Markdown
Contributor Author

tlabaj commented Feb 26, 2026

@kmalyjur Could you please re-review this one?

Copy link
Copy Markdown
Contributor

@kmalyjur kmalyjur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just an initial review, I'll look at it again on Monday.

It looks great now, the time is in good format, but it is overlapped and not readable:

Image

onclick,
noDataMsg,
config,
unloadData,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so sorry, I think I told you before that it's unused, which it is, but I forgot about: "Received props should be kept the same, otherwise this task should also refactor the chart uses in the plugin."
It should be there, and the default should be false.

@kmalyjur
Copy link
Copy Markdown
Contributor

Thank you, the code looks right now. The only thing that works/looks different from the old chart is the timestamps. I explain how I understand it in the comment above.

@tlabaj tlabaj force-pushed the areachart branch 3 times, most recently from 2a86311 to f459f34 Compare March 10, 2026 19:33
@kmalyjur
Copy link
Copy Markdown
Contributor

LGTM, I need to verify it now

@kmalyjur
Copy link
Copy Markdown
Contributor

kmalyjur commented Mar 16, 2026

I noticed a few more things that may need fixing.

  • There is the same issue as in BarChart with the "Time in seconds" text and the y-axis.
  • The x-axis text could be longer and not readable - a tooltip for longer text could be used. EDIT: Although we could assume it's not that long in our case, so my comment might be irrelevant.
  • When hovering over the color square in the legend, the mouse looks like it should be clickable, but I think it isn't - should it be doing anything?
image

@kmalyjur
Copy link
Copy Markdown
Contributor

@tlabaj I have the same comment on it as on the BarChart PR - could the padding not be hardcoded? I worry it would be overlapping again for longer y-axis values.

@tlabaj tlabaj force-pushed the areachart branch 5 times, most recently from 554dd27 to 7d45eda Compare March 23, 2026 14:50
@kmalyjur
Copy link
Copy Markdown
Contributor

@tlabaj Thank you for your changes, it looks good.
I left this comment (#10743 (comment)) for the BarChart, the logic could be used for AreaChart, too.

@tlabaj tlabaj force-pushed the areachart branch 2 times, most recently from 2a383dd to efcd088 Compare March 25, 2026 14:53
Copy link
Copy Markdown
Contributor

@kmalyjur kmalyjur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label is cut off:
Image

axisLabelComponent={
yAxisLabel ? (
<ChartLabel x={Y_AXIS_LABEL} dy={yAxisLabelOffset} />
) : undefined
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter error

: t;
};

/** Match BarChart: fixed decimals for normal range; scientific notation for very large magnitudes. */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great comment, but "Match BarChart" is unnecessary

const DEFAULT_HEIGHT = 250;
const DEFAULT_WIDTH = 800;

/** Left padding is computed from y-axis tick label width (see BarChart). */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good comment, but "(see BarChart)" seems unnecessary

Copy link
Copy Markdown
Contributor

@kmalyjur kmalyjur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the label. Other than that, it's ready to get merged.

Co-authored-by: kmalyjur <78563507+kmalyjur@users.noreply.github.com>
Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants