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 scale bugs in bar and line charts type #3297

Closed
CauanCabral opened this issue Sep 13, 2016 · 8 comments · Fixed by #4545 or #4556
Closed

Time scale bugs in bar and line charts type #3297

CauanCabral opened this issue Sep 13, 2016 · 8 comments · Fixed by #4545 or #4556

Comments

@CauanCabral
Copy link

Hi,

I see there's some issues with charts of bar type when "xAxes" are time scaled. Found myself with that bug and did some examples to confirm:

chartjs_time

Simple example using "category" scale (works fine): http://codepen.io/CauanCabral/pen/dpGkzX
Simple example using "time" scale (doesn't works): http://codepen.io/CauanCabral/pen/ZpQvbb

Seems that problem occur not only with bar type, but also with line, as follow:

Simple example of line type and "time" scale (doesn't works too): http://codepen.io/CauanCabral/pen/WGAXJg

My workaround are treating scale as "category", set scale with integer timestamp. So format "ticks" and "tooltips" manually to display as date. Another trick is explicity define min and max of axes.

Any idea what are the scale problem? If so, maybe I can help with a PR.

Thanks for that great work.

@etimberg
Copy link
Member

@CauanCabral are you referring to the giant gap on the left side of the chart before the first line?

@CauanCabral
Copy link
Author

@etimberg yes. But are others problems too.

In image above, my datasets have 3 dataset, with 6 points, but line have only 5.
I build him explicitly setting xLabels and yLabels - this is wrong? My x values are unix timestamp.

For chart bar at codepen example, you can see again 1 "bar" is missing from chart (array data define 5 "bars", but shown only 4). Also, the last two labels are overlapping.

@CauanCabral
Copy link
Author

One more thing®, when scale are not "time", there's no problem whith labels/points.

Thanks.

@etimberg
Copy link
Member

#3233 has a potential solution to the large offset problem. it comes in because of the larger labels.

The bars do not work well on time axes. This is covered by other open issues. The problem is that it is difficult do determine a sizing algorithm that works in the majority of cases. If you have ideas, please leave them in #2415

@CauanCabral
Copy link
Author

Thanks, I'll following thats issues.

And about missing datapoints in graphic? That occur in both graphics type (line and bar) when scale is time.

I'm forgetting something or it's bug?

@etimberg
Copy link
Member

Do you mean the missing bar?

@CauanCabral
Copy link
Author

Yes

@etimberg
Copy link
Member

Yup, I think that's related. I think it's getting calculated with a very small width and so doesn't appear

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