Closed volter closed 2 years ago
This should definitely be supported. The main challenge is the UX. If we can figure out a intuitive way to configure this, I'll have this fixed in a day. I'd like for this to be easy to configure, without too much magic, and ideally with as few UI controls as possible.
For example, could we reuse the End time dimension and have it accept both time and number fields? Gut feeling tells me that new users will probably try this first?
Should we make it more explicit by adding a radio group to select between time and duration, which dynamically changes the UI.
We probably want to be able to control the unit of the duration field. I'm thinking we can reuse the Unit set in the field options rather than introducing another dropdown.
I did some prototyping on how to configure this. I realized that we can't use the same dropdown and detect time/duration based on the field type, since you can select a number field of Unix epochs to use as the end time.
I experimented with having two separate dropdown and disable the other when you select a field from one of them, but I prefer not to show options that the user cannot change.
The best alternative I've found so far is to use a radio group to determine how the field should be interpreted. It takes up real estate, but it makes it clear what you're configuring, and you can interact with all the options (no disabled options). Here's a demo of what I have so far.
I'd love your feedback on whether this feels natural for you to configure duration vs end time.
Right now, I'm using the Unit field option to determine the unit of the duration field.
The benefit is that we get formatting for free since it's a built-in feature. The downside is that it might not obvious that you need to create a field override.
I'm afraid that this does not cover the situation where the end time is a time stamp and duration has to be subtracted from it.
Time only goes forward. That's to say that you don't really need to slap a label on what's the start and what's the end timestamp. The Gantt chart will only have the area filled anyway -- no more than that.
I would say that having two fields and two toggles should be enough. One of the fields has to be a timestamp, the other can be an interval or a timestamp. You just need one additional toggle for the interval to say if it's forward or backward.
you don't really need to slap a label on what's the start and what's the end timestamp
Each field option needs to have a label. If not start and end, what would be a better label for configuring the time dimensions?
Your suggestion would certainly be a general and highly configurable approach. While I don't doubt that there are users who'd like to combine duration with end time, I don't think it's a common scenario. My concern with this is that it comes at a cost of usability. Allowing users to manually combine permutations of timestamps and durations results in a UX challenge where we would need to handle an invalid combination, i.e. duration + duration (the radio group component doesn't let you disable values).
I don't want to write this solution off yet, but I'd like to explore other options that would make this easier to configure.
One alternative that popped up while writing this would be to define the valid combinations as a radio group. Could look even better with descriptive icons as well.
Timestamp and duration data can be used for grafana-gantt-panel
with a help from grafana Transformation functionality.
Select Add field from calculation
with binary operation mode.
That's a great idea, but I'm not sure if that's gonna work with Elasticsearch timestamps.
I've got a use case where my data either has a start or an end timestamp plus a duration. I would like to pick a timestamp, choose whether it is the start or end, then pick a duration field and define a unit for it.
While some datasources may allow for converting that information into the necessary second timestamp, it can be impossible or very cumbersome for others. It would of be possible, of course, to store both an additional timestamp and the duration in the first place. However, I feel that doing that math in Grafana might be the more flexible approach.