Skip to content

Charts starts with zero #1212

@kirik

Description

@kirik

Currently, if you select data with 1-minute granularity, the WHERE conditions for time buckets do not respect the selected granularity.
For example, when choosing 1m granularity, it does not select from the start of the minute to the end of the minute, but instead uses timestamps including seconds and milliseconds.

WHERE
            (
                TimeUnix >= fromUnixTimestamp64Milli (1758938282942)
                    AND TimeUnix <= fromUnixTimestamp64Milli (1758941882942)
                )

that's why we have zeroes in the beginning of the charts.

If we add toStartOfInterval to time from and dateAdd to time to with specified granularity - that will fix an issue:

        WHERE
            (
                TimeUnix >= toStartOfInterval(fromUnixTimestamp64Milli (1758938282942),  INTERVAL 1 minute)
                    AND TimeUnix <= dateAdd(toStartOfInterval(fromUnixTimestamp64Milli (1758941882942), INTERVAL 1 MINUTE), INTERVAL 1 MINUTE)
                )

Looking forward for comments;
Thank you!

UPD
I found includedDataInterval in .ts files, but not sure if it configurable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions