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

bar chart with widths based on time range #6317

Closed
niranjansooda opened this issue Jun 4, 2019 · 3 comments
Closed

bar chart with widths based on time range #6317

niranjansooda opened this issue Jun 4, 2019 · 3 comments

Comments

@niranjansooda
Copy link

IMG_20190604_142940847

I am trying to find whether it would be possible to draw a bar chart like attached in the image based on time range.

Let us suppose the x axis have all the week days.let us suppose monday is divided into 24 hours.

based on the image taking first bar let us say i got an event from monday 6pm to tuesday 4AM the bar should cover that area along x axis like shown in the image.

then again from tuesday 11AM to 3PM another event occured it should cover that particular area. and it should draw bars based on time ranges.

so the bar should have width based on different time ranges.

can some one help if it is possible to do above case in chart.js .I recently started with chart.js and don't know whether above functionality it supports.

@benmccann
Copy link
Contributor

I think you should be able to. You'd want to use barThickness: flex, distribution: linear. See the example in the bottom right in the description of #4994

@niranjansooda
Copy link
Author

hi @benmccann

i tried looking into above description but the data takes only array of starting points and the width adjusts itself using flex.

i want each each bar to take both starting point { x1 : jun 2nd 11AM ,y1 :100% } and ending point { x2: jun 3rd 2AM, y2 :100%} and the the bar should fill the color between these two points along x axis.

and then again take another two points {x1:jun 3rd 6PM, y1 :100%} and ending point { x2: jun 4rd 1AM, y2 :100%} and the bar should fill the color between these two points. and should continue like this.

can you please look at the above photo to get more clarity on my requirement and confirm whether it is possible? i attached the stack blitz link i tried using your suggestion.

https://stackblitz.com/edit/charting123

@benmccann
Copy link
Contributor

We just added support for having different y1 and y2 starting and ending points: #6056

It's not supported for x though. You'd have to build your own custom controller for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants