hyperdx icon indicating copy to clipboard operation
hyperdx copied to clipboard

Charts starts with zero

Open kirik opened this issue 2 months ago • 3 comments

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.

kirik avatar Sep 27 '25 03:09 kirik

Hrmm it's not clear to me that it'd be a good idea to overwrite the user's time range setting to match with granularity by default. We could introduce an option to allow users to opt into it if they wish to do so (hide incomplete time intervals or something)

MikeShi42 avatar Oct 02 '25 02:10 MikeShi42

That makes sense, thank you sir.

kirik avatar Oct 02 '25 03:10 kirik

This is a big problem for me because my chart values are very close together (say milliseconds).

So the huge difference between 0 and my values results in that the y-axis becomes tall and the chart becomes useless.

I would need the ability to hide incomplete intervals, or a way to force a y-axis range (for the pic below, I would want something like 2.8-3.0)

Image

Thanks for the help!

carmocca avatar Oct 20 '25 21:10 carmocca