Skip to content

[ENHANCEMENT] ScatterChart: make axis and tooltip timezone aware#712

Merged
andreasgerstmayr merged 2 commits into
perses:mainfrom
andreasgerstmayr:scatterchart-timezone
Jun 30, 2026
Merged

[ENHANCEMENT] ScatterChart: make axis and tooltip timezone aware#712
andreasgerstmayr merged 2 commits into
perses:mainfrom
andreasgerstmayr:scatterchart-timezone

Conversation

@andreasgerstmayr

Copy link
Copy Markdown
Contributor

Description

scatterchart: make axis and tooltip timezone aware

Screenshots

No UI changes, except that the timezone from the TimeRangeSelector is respected.

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
@andreasgerstmayr andreasgerstmayr requested a review from a team as a code owner June 29, 2026 11:36
@andreasgerstmayr andreasgerstmayr requested review from Gladorme and removed request for a team June 29, 2026 11:36
@andreasgerstmayr andreasgerstmayr changed the title [ENHANCEMENT] scatterchart: make axis and tooltip timezone aware [ENHANCEMENT] ScatterChart: make axis and tooltip timezone aware Jun 29, 2026
return formatWithTimeZone(timeStamp, 'MMM yyyy', timeZone);
}

// between 10 days to 6 months

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happen between 2 years and 6 month ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you still make a screenshot for this ? if not to complicate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the identical axis formatter as used in the timeseries, heatmap and statushistory charts:
https://github.com/perses/plugins/blob/39a7700a8fd33c1539a1af12b828db35bcdd91d0/timeserieschart/src/utils/timezone-formatter.ts
https://github.com/perses/plugins/blob/39a7700a8fd33c1539a1af12b828db35bcdd91d0/heatmapchart/src/utils/get-formatted-axis-label.ts
https://github.com/perses/plugins/blob/39a7700a8fd33c1539a1af12b828db35bcdd91d0/statushistorychart/src/utils/get-formatted-axis-label.ts

It's a way to make the axis timezone-aware. If the range of the chart is too long it uses years, otherwise months, days, hours etc.

Probably a candidate to move to https://github.com/perses/shared/tree/main/components/src/EChart (including the bug fix below)?

Screenshot:

What happen between 2 years and 6 month ?

I think you just discovered a bug in all these charts :D
You're right, it'll fall back to the return statement, which formats it as HH:mm. I fixed it now in this file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I created perses/shared#190 to pull this shared code in the perses/shared repo. But we'll need a new release before I can remove it from the plugins here.

Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>

@celian-garcia celian-garcia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lgtm. The update for alignment can be done later indeed

@andreasgerstmayr andreasgerstmayr added this pull request to the merge queue Jun 30, 2026
Merged via the queue into perses:main with commit 4e5214c Jun 30, 2026
16 checks passed
@andreasgerstmayr andreasgerstmayr deleted the scatterchart-timezone branch June 30, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants