-
Notifications
You must be signed in to change notification settings - Fork 523
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
How to chart date ranges with bars #2838
Comments
I'm having trouble visualizing what type of chart you are looking for, could you mock something in a graphics drawing program? Are you looking for something like a stacked horizontal chart? |
Here is an example of using events and state to achieve that effect. |
Cool, do you think the VictoryBar is the best option for this? There is one remaining issue which is the static I tried |
I don't think there is a useful way to get the dimensions from the axis to predetermine the offsets correctly. It may be that another chart type is a better fit. I like to reference [this site for data visualizations] when I'm looking for the right fit. (https://datavizcatalogue.com/blog/chart-combinations-timelines/). Take a look here and see if something fits better for your use case. |
Thanks, I'll take a look. I also looked into the stack horizontal chart suggestion, I think it might be possible, I post back if I can get it to work. |
Is there an existing issue for this?
Code of Conduct
Question
I would like to chart date ranges using bar widths where
y
is a constant andx
are dates, the width of the bar represents the date range of an event. I'm not sure what the best way to do this is.I tried using a
VictoryBar
where I would set they
to a constant like500
and thex
would be thedate
.https://codesandbox.io/p/sandbox/bar-chart-date-ranges-3v86cm
Its not the best solution because it renders multiple bars for each date range and I would have to set a width constant so the bars overlap to give the impression of a single wide bar. The same issue with mouseover events, there are multiple bars instead of one for a range. Is there a chart where the width of the bar can be set based on the
X
values? like spanning 3 ticks for an event that spans 3 dates or set a start tick and an end tick per bar based on event start and end? I now I can set the bar width using a function but that would require knowing how wide to make it to match the ticks.The text was updated successfully, but these errors were encountered: