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

Chartjs v2.7 - combo chart with time-series (financial) data; bar width's are irregular #4983

Closed
btumbleson opened this issue Nov 22, 2017 · 2 comments

Comments

@btumbleson
Copy link

So I had some issues with previous versions of Chartjs (namely 2.5) when I was working with a combo chart (bar + line) and had difficulties with time-series data.

For context, I'm using financial data (stock price and volume). Since the market is only open 5 days a week, there is a "gap" in the data. I don't worry too much about this gap, but when using Chartjs's re-written functionality for time-series data, the width of the bars becomes irregular. Here's an example:

image

You can see that each "Friday" and "Monday" of data, the bars get larger to compensate for the gap. The xAxes code that creates this is:

type: 'time',
       time: {
       unit: 'day',
       distribution: 'linear'
       }
....

Now if I remove the type: time distinction, I get the standard bars, but the labels are pulling straight from my data, rather than being parsed as dates and correctly managed by Moment.js:

image

....

To sum it up: how can I get regular-spaced bars when my data is not regularly linear while utilizing Chartjs's time-series axises? Is this a bug?

@etimberg
Copy link
Member

Looping in @benmccann and @simonbrunel. I believe this might be a duplicate of another issue

@benmccann
Copy link
Contributor

benmccann commented Nov 23, 2017

At least similar issues have been reported before. I'm not sure if they're all exactly the same, but there have been a handful of recent bugs filed against the bar chart such as #4911, #4745, #4825. We should really change the default bar chart behavior so that all bars are equal width.

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

3 participants