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

Buggy bars when type time & stacked #6437

Closed
jacobsorme opened this issue Aug 5, 2019 · 1 comment · Fixed by #6576
Closed

Buggy bars when type time & stacked #6437

jacobsorme opened this issue Aug 5, 2019 · 1 comment · Fixed by #6576

Comments

@jacobsorme
Copy link
Contributor

jacobsorme commented Aug 5, 2019

Expected Behavior

I use a stacked bar chart and xAxis.type is time. I expect bars to be stacked when on the same t value (the data looks like {t: new Date(…), y: … }. If some data point is the only one at that time I expect no stacking. I also expect the bars of the datasets to have the same width.

Current Behavior

The bars seem to be stacked by their index in data (check how tooltip highlights the bars in pic below, and how the blue ones are flying in level with green at same index) but placed according to their t (time). Somehow the width of bars are also affected. The blue data exist on times where the green one does not (see JSBin below).
image

Possible Solution

I am not sure here, I imagine a solution that truly checks the time and all as quite complicated. Could we stack the bars with regards to time, and not index? Time and dates in Javascript have nice operands, eg. two Date-objects can be compared with == and > etc.

Steps to Reproduce (for bugs)

Check jsbin.

Context

I was working with stacking data coming from certain times. Made an example where the two datasets to be stacked did not both exist on all timestamps.

Environment

  • Chart.js version: 2.8.0/Chart.bundle.min.js from CDN
  • Browser name and version: Edge
@zhum
Copy link

zhum commented Sep 22, 2019

Confirm this bug on Firefox browser. It appears not only if data is stacked, with two or more datasets too.

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

Successfully merging a pull request may close this issue.

2 participants