Forum Discussion
Visual simultaneous events
Hi all,
We want to have a visual similar to the one below so that we can see where users were active simultaneously. Each row on the y axis is a different user, the x axis is time and the yellow bars show the time period(s) on which a user was active in the system.
Can you recommend a visual capable of this?
Note we will need a slicer on datetime (x-axis) to allow the user to concentrate on a specific period
Thanks
12 Replies
- TomMartensSuper User
Hey AlB ,
currently I'm considering each data visualization task being a nail and deneb the hammer:
https://deneb-viz.github.io/Maybe these examples provide you with an idea what can be done
- https://vega.github.io/vega-lite/examples/rect_lasagna.html
- https://vega.github.io/vega-lite/examples/trail_comet.html
I cosnider deneb or being more precise vega and vega-lite on par with seaborn and ggplot2 (maybe not fully on par) but deneb bring the interactivit to the table that r and python charts are completely missing.
Hopefully this provides some ideas.
Regards,
Tom
- AllisonKennedyCommunity Champion
AlB Timeline Storyteller might get you close? https://excelwithallison.blogspot.com/2021/06/custom-visual-review-happy-fathers-day.html
- mahoneypatMicrosoft Employee
I agree with TomMartens . Deneb can be used for this one with the "tick" "mark". I am glad to try it out, if you provide some sample data.
Pat
- AlBCommunity Champion
Thanks very much AllisonKennedy
That doesn't seem to do what we need.
Any other ideas?
MFelix Greg_Deckler mahoneypat TomMartens parry2k lbendlin Pragati11
- Pragati11Super User
Hi AlB ,
Just wanted to understand why the solution from AllisonKennedy doesn't work?Have you tried checking Python/R route for this? Something like this:
https://towardsdatascience.com/advanced-plots-in-matplotlib-part-2-e88f91ce9e31
I haven't tried this though.
- Greg_DecklerCommunity Champion
- AlBCommunity Champion
Thanks Pragati11 Greg_Deckler TomMartens
mahoneypat thanks for the offer. I'm attaching some sample data with the start and end times for the events per user. Users timelines should be depicted one above the other along the y axis as in the pic on my initial post.
Thanks a lot
- mahoneypatMicrosoft Employee
I missed that you had start/end times, so used a "rect" mark instead (so an "x2" value could be provided). How does this look? If it works, the "spec" is below that you can copy/paste into your Deneb visual. There is a lot more you can do with the formatting of course.
{
"data": {"name": "dataset"},
"mark": {"type": "rect"},
"encoding": {
"y": {
"field": "User",
"type": "nominal",
"axis": {"title": null}
},
"x": {
"field": "StartDateTime",
"type": "temporal",
"axis": {"title": "DateTime"}
},
"x2": {"field": "EndDateTime"}
}
}
Pat
- AlBCommunity Champion
Thanks mahoneypat
That gets me pretty close. I was playing with it and would need to change a couple of things that i haven't been able to:
1. Change the color of the bars
2. Can the visual be sorted by one of its fields?
3. I have a tooltip now but would like it to show User first instead of after StartTime. Can that be changed?
I'm attaching a pbix with your Vega code in a Deneb visual and the events data
Thanks a lot
- mahoneypatMicrosoft Employee
Please see the attached that addresses:
- Specifying fields and the display order for the tooltip. Note that a "format" is also needed to get the the datetime values to show in full
- Specify a different "color" for the "mark" or using the User field in "encoding" (two different tabs; not sure which one you wanted)
- Sorting by a field. I didn't see an additional field, so I sorted by User descending to demonstrate the syntax.
Pat
- Br1-981Helper I
mahoneypat Very useful, thanks for letting me discovering this visual, literally saved my day!
Do you know if is it possible to remove completely the legend?
Do you have further documentation about it?
Thanks in advanceBruno