Skip to content

Conversation

@withlin
Copy link

@withlin withlin commented Dec 26, 2025

Fixes #956

default.mov
image

…ictoriaMetrics#956)

- add bars count dropdown with predefined steps (12..1240, default 96)

- persist bars count across URL/search params and reuse for Query/Overview flows

- pass bars count through fetch, time bucketing, and uPlot rendering for consistent bar sizing

- allow SERVER_URL override via localStorage for remote backend testing

Fixes VictoriaMetrics#956
@withlin withlin changed the title app/vmui: feature: add selectable bars count for hits/stats charts (#… app/vmui: feature: add selectable bars count for hits/stats charts Dec 26, 2025
@valyala valyala requested a review from Loori-R December 26, 2025 22:19
@valyala
Copy link
Contributor

valyala commented Dec 26, 2025

@withlin , thank you for the pull request!

@Loori-R , @arturminchukov , could you review this PR?

@valyala valyala added the web-ui Issues related to the user interface: layout, styling, usability, or UI-specific bugs. label Dec 26, 2025
Copy link
Contributor

@Loori-R Loori-R left a comment

Choose a reason for hiding this comment

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

Overall looks good. I left a couple of comments to sync this PR with the new bar rendering logic from PR #988 and avoid conflicts. Also, please add an entry to docs/victorialogs/CHANGELOG.md.

Copy link
Contributor

Choose a reason for hiding this comment

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

For sync with PR #988 (bar rendering fix), this file should not be changed. paths no longer depends on bars count.

Copy link
Contributor

Choose a reason for hiding this comment

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

For sync with PR #988: app/vmui/packages/vmui/src/utils/uplot/paths.ts will be removed, so please avoid making changes here.

};

export const getHitsTimeParams = (period: TimeParams) => {
export const getHitsTimeParams = (period: TimeParams, barsCount = LOGS_DEFAULT_BAR_COUNT) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid conflicts with PR #988, could you align this with the implementation from

export const getHitsTimeParams = (period: TimeParams) => {
const start = dayjs(period.start * 1000);
const end = dayjs(period.end * 1000);
const totalMs = Math.max(1, end.diff(start, "ms"));
const bars = Math.min(LOGS_BARS_VIEW, totalMs);
const step = Math.max(1, Math.ceil(totalMs / bars));
const offset = ((start.valueOf() % step) + step) % step;
return { start, end, step, offset };
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

web-ui Issues related to the user interface: layout, styling, usability, or UI-specific bugs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Built-in web UI: add an ability to change the number of bars displayed on the bar chart

3 participants