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

Time cartesian with grouped data #5139

Closed
reflectionhu opened this issue Jan 11, 2018 · 12 comments · Fixed by #8641
Closed

Time cartesian with grouped data #5139

reflectionhu opened this issue Jan 11, 2018 · 12 comments · Fixed by #8641

Comments

@reflectionhu
Copy link

Hello all. First thanks for this fantastic plugin, but I have a (hopefully small) problem.

I'm using time cartesian chart with grouped dataset (please see included codepen) to display engine temperatures (start @ datetime, max @ datetime, stop @ datetime) . Time axis works well if only one dataset array is provided.

To understand my logic, please have a look at the following description. Currently I am working with 6 start-run-stop cycles for testing purposes.

Entry logic:
entry = {x: event datetime (moment), y: temperature (int)};

Dataset logic:
Engine start temp = [entry1start, entry2start, entry3start];
Engine max temp = [entry1max, entry2max, entry3max];
Engine stop temp = [entry1stop, entry2stop, entry3stop];

Expected Behavior

Please have a look at the attached drawing.

Current Behavior

Time scale should be distributed by assigned datetime. Eg. first cycle:
start @ 2017-11-02T20:30:00.000Z,
max reached @ 2017-11-03T13:07:00.000Z
stopped @ 2017-11-03T16:30:00.000Z

Now have a look @ codepen.
start is ok
max reached at 13:07, seems to be ok
stopped at 16:30, but bar is at the end of day

Second cycle is started at 20:53 but bar is placed before previous cycle's end
2nd cycle's max is reached at 11-04 04:50 but placed in center of day
2nd cycle's end is at 11-04 11:50 but placed to beginning at 11-05

...and so on

Possible Solution

Steps to Reproduce (for bugs)

I created a Codepen to reproduce my problem.
https://codepen.io/anon/pen/WdJrJY

Context

Environment

  • Chart.js version: 2.7.1
  • Browser name and version: Chrome 63.0.3239.132 64bit
  • Link to your project:
    untitled-1
@etimberg
Copy link
Member

It almost looks like some bar positions got swapped at some point. @simonbrunel @benmccann any thoughts?

@simonbrunel
Copy link
Member

Certainly fixed by #4994: @reflectionhu can you checkout that PR and verify if it fixes your issue?

@simonbrunel
Copy link
Member

@reflectionhu actually no need to checkout the PR, you can directly use https://rawgit.com/chartjs/chartjs.github.io/master/dist/master/Chart.min.js

@simonbrunel
Copy link
Member

It doesn't seem to work better

@etimberg
Copy link
Member

I think the code assumes that the 3 stacks are beside each other which is not the case here. as such, the bars are offset in the wrong direction

@reflectionhu
Copy link
Author

@simonbrunel thanks for the .js you provided. X axis distribution is not okay yet, but seems to be much better than in 2.7.1.

@kurkle
Copy link
Member

kurkle commented Dec 16, 2018

It seems this was fixed in 2.7.2 already

5139

Edit: No, I was wrong. It's still not fixed.

@kurkle
Copy link
Member

kurkle commented Jan 3, 2019

setting stacked: true fixes the issue in 2.7.2 or later

@simonbrunel simonbrunel removed this from the Version 2.8 milestone Mar 1, 2019
@benmccann
Copy link
Contributor

Closing this since it was reported as fixed

@simonbrunel
Copy link
Member

setting stacked: true fixes the issue in 2.7.2 or later

This is not fixed and requiring setting stacked: true is not the solution.

@kurkle would explain better than me why it's not fixed.

@etimberg
Copy link
Member

etimberg commented Oct 16, 2020

I think this issue is still occurring in v3.0.0-beta.4 https://codepen.io/anon/pen/WdJrJY

Edit:
v3.0.0-beta.11 version https://codepen.io/etimberg/pen/poNWbBr?editors=0010

@kurkle
Copy link
Member

kurkle commented Mar 14, 2021

v3.0.0-beta.13 with markers for the correct locations (at UTC+2):

image

https://codepen.io/kurkle/pen/XWNGjdN

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.

5 participants