Create a State Timeline Chart

I am trying to create a chart in Grafana that shows durations for specific events over time. Specifically, I am attempting to use the State Timeline visualization option to plot the durations of these events as a function of their start and end date. I am able to generate data using the State Timeline option, but cannot get it to render correctly. Below are my current inputs/outputs for two data points (App1 and App2 as separate queries):

Here is the desired result, which shows the duration of the events for App1 (43 days) and App2 (35 days) and accurately depicts them on a timeline:

I feel I might be missing a key element to enabling this visual…any assistance is most appreciated.

You can specify start date and end date.

An example with Infinity datasource:

NULL state is hidden using Value mappings (Display text contains invisible character from here, color is set to transparent):

@ebabshko - Thank you for your insights, I think this is very close to the solution. I replicated your queries, but I am not quite rendering the same visualizations. Can you please confirm the Transformation source/type you are using? I am attempting to transform the “time” field as a time value.

Additionally, I am attempting to use a transparent character/color value for the NULL value mapping. Do I formally need to enter a transparent custom entry, or can I use the default transparent color option? Thanks again!

is your real datasource csv?

@yosiasz - Yes, the original data source will be a CSV file. I am using Infinity as this example since it is sometimes easier to use than the CSV plug-in. I feel I am close to the solution, but just need to confirm the query/transformation settings.

1 Like

have you looked at UQL wherein you can do your calculations to add dates to your date field etc?

https://grafana.github.io/grafana-infinity-datasource/docs/uql

Value mappings:

JSON of panel:
sample.json (2.9 KB)

1 Like

@ebabeshko - I am using the Convert Field Type transformation for the “time” (base field name) parameter. I also set the NULL value field mapping to transparent, but do I also need to change the color scheme to “single color”? I tried that as well but it didn’t work, so I may be missing something.

grafana_state_timeline_test_8

Here is what my screen currently shows…it is close, but needs a couple tweaks - Thanks again!

Could you try the JSON that I provided? At your panel choose Inspect - Panel JSON and use contents of .json attached to previous post replacing datasource id to your one.

@ebabeshko - I copied/pasted the JSON contents (replacing w/my UID) into the Query Inspector and it worked perfectly! I’m not sure why the edits to the infinity data source/source did not work as seamless, but I have the solution I need. I will confirm your solution as the correct answer, thanks again!