Skip to content

[Lens] Ability to define first day that starts the week on date histogram axis #178115

@dej611

Description

@dej611

Describe the feature:

In Kibana there's the dateFormat:dow setting who defines the default day for the beginning of a week.

Screenshot 2024-03-06 at 14 39 21

Passed to moment week option here...

const setStartDayOfWeek = (day: string) => {
const dow = moment.weekdays().indexOf(day);
moment.updateLocale(moment.locale(), { week: { dow } } as any);
};
this.uiSettingsSubscription = merge(
uiSettings.get$('dateFormat:tz').pipe(tap(setDefaultTimezone)),
uiSettings.get$('dateFormat:dow').pipe(tap(setStartDayOfWeek))
).subscribe();

Moment defines this option in their docs here, but affect startOf and endOf logic.

Chart bins are determined based on the data passed to charts, this would require using the offset option of the date_histogram aggregation.

This information is not picked up correctly by Lens when displaying on a weekly bucket.
In this example I'm using the ecommerce sample dataset and setting a minimum interval of week for the date histogram (on a 3 months timespan):
Screenshot 2024-03-06 at 14 39 58

Note how both the axis and tooltip pick ups the Monday dates for each week bucket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:LensTeam:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//bugFixes for quality problems that affect the customer experienceimpact:mediumAddressing this issue will have a medium level of impact on the quality/strength of our product.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions