Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide scaleXTimeOffset for relative duration axis #468

Closed
vlsi opened this issue Oct 31, 2021 · 5 comments
Closed

Provide scaleXTimeOffset for relative duration axis #468

vlsi opened this issue Oct 31, 2021 · 5 comments

Comments

@vlsi
Copy link

vlsi commented Oct 31, 2021

The use case is to show "time since test start" axis.

The axis labels should be formatted like "2h 30m", "1d 2h", "1w 2d 3h", or something like that.

@IKupriyanov-HORIS
Copy link
Collaborator

Hi! Could you say what kind of data is in input? Is it UNIX-time, formatted strings, zero-based nanosecond events?

@vlsi
Copy link
Author

vlsi commented Nov 16, 2021

Here's the use-case: apache/jmeter#674 (comment)

The chart displays "arrival rate" vs "time since test started" data.
I prepare the data, so I can prepare it in whatever format is needed.

I think zero-based (nano)second events would work the best, since the display of UNIX-time requires the notion of "timezone", and I do not have timezones (the meaning of the axis is "time since the beginning of the test")

@vlsi
Copy link
Author

vlsi commented Nov 16, 2021

Just in case, for now, I use a numeric horizontal axis, and I perform manual scaling which adjusts units depending on the total duration. It turned out to be not that bad to show the horizontal axis as "numeric hours" or "numeric minutes".

        val totalDuration = time.last()
        val timeUnit = when {
            totalDuration > 2.5 * TimeUnit.DAYS.toSeconds(1) -> TimeUnit.DAYS
            totalDuration > 2.5 * TimeUnit.HOURS.toSeconds(1) -> TimeUnit.HOURS
            totalDuration > 2.5 * TimeUnit.MINUTES.toSeconds(1) -> TimeUnit.MINUTES
            else -> TimeUnit.SECONDS
        }
        if (timeUnit != TimeUnit.SECONDS) {
            val scale = 1.0 / timeUnit.toSeconds(1)
            for (i in time.indices) {
                time[i] *= scale
            }
        }

@IKupriyanov-HORIS
Copy link
Collaborator

Thank you! Will check how we can implement this.

@IKupriyanov-HORIS
Copy link
Collaborator

IKupriyanov-HORIS commented Dec 13, 2021

Thank you for your feedback! scale_x_time and scale_y_time are implemented in v2.2.1. Make us know if there are other improvements can be made.

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

No branches or pull requests

2 participants