-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Axis scaling: Time ignores bound option and max option. #6464
Comments
@joeyhub can you add an interactive example on plukr, codepen (e.g. https://codepen.io/pen?template=JXVYzq), or a similar site? |
I'm seeing a lot of things that are a bit off. The fiddle doesn't have moment.
There's also some mess up with the timezones. Ticks are drawn to UTC but points to GMT / DST. The documentation doesn't mention TZ but in any event if not specified it should be the same everywhere! I'm guessing you're using In my graph in the legacy code, it's not drawing the label at an angle, I have no idea why as maxRotation is left to default. Maybe it's some weirdness competing with the yAxes for height? It seems like the kind of thing that is undefined behaviour and you have to fiddle until it works. Though it makes no sense that it jumps around when the yAxes is constant. In the fiddle, changing source to data causes rotation! It appears to be arbitrary. It also seems to snap it to UTC? Or not, it's just snapping to points then flooring? This produces double printed points of the same day that overlap if you shift them an hour apart! When it orients horizontally in my legacy case, it prints extra padding at the end. Angular chart 1.1.1 -> Chart.js 2.3.0. |
For me in my legacy example, the grid lines are drawing all the way up to the bounding box defined by labels where as in the fiddle about they truncate / are cropped to the date bounds rather than the label overflow. In my legacy case they also protrude ever so slightly because of the TZ error. There's another oddity that when replicated in the fiddle the protrusion doesn't result in grid lines being drawn, I'm guessing someone has mucked around with the global defaults in my case such the gridlines snap to the parent box though I don't see any obvious settings that would do that being changed. For me gridlines extend all the way to the top of 350's bounding box and the right of Jan 11's bounding box. That looks like a problem with settings, I hope, and not an arbitrary thing like the label orientation. Though I see nothing obvious in the legacy touching any explicit settings directly specifying where to draw gridlines to. The TZ drift however is a problem under the hood. The only way to fix it would be using custom handling instead making time potentially useless. I don't think it's just superficial, the method of iterating ticks / stepping would need to be addressed as well. |
https://jtblin.github.io/angular-chart.js/ A lot of the examples here overshoot. Though I don't see anything in their lib that would obviously cause that. |
This is weird. I copy the chart data from the angular-chart.js example page of one with over draw....
This is actually the wrong one, I intended to copy the reactive one. In the fiddle it doesn't show the overdraw at the top. On the demo page though it does. |
Half the issue is that angular-chart.js is unmaintained abandonware (that falsely gives the impression of using 2.x latest). I've raised an issue with them to either transfer it or shut it down via a great big notification in their readme, possibly with a redirect to something else that's the same (or back down to bare chart.js). I'm guessing in some version after 2.3.0 you changed how grid lines are drawn? |
It looks like this plugin is very outdated and causing problems for users. See jtblin/angular-chart.js#712 and chartjs/Chart.js#6464
I'd highly recommend using 2.8.0. There's too much different that's changed since 2.3.0 to really be able to effectively offer much guidance |
I have managed to swap out 2.3 for 2.8 which fixes the grid over draw issue now that I know the version bundled with the angular lib wasn't actually the latest. The only thing remaining is that even with 2.8 there appears to potentially be a discrepancy when using Date with points versus ticks and timezones. I'm not sure if it's the case for use with moment though. |
You could try the luxon adapter. It has timezone support, which moment doesn't by default |
It seems the issue is here: It should be possible to implement UTC versus local, in JS you should normally always have support for both locale and UTC using either native (albeit hacksome) or moment. For others that's an additional feature.
|
This is due to how moment formats dates. Using another date adapter such as luxon solves the problem https://jsfiddle.net/joLp0fw5/ |
When I set bound to fit to the data, it still draws with extra padding to the right of the data.
When I force it with max to fit the data, it still adds padding to the right to draw the label rather than not drawing the label or culling it.
The text was updated successfully, but these errors were encountered: