Offset ignored when min and max axis values are set
See original GitHub issueBar charts with a date x-axis does ignores offset: true
when time.min
and time.max
are set.
Expected Behavior
Offset should work even if time.min
and time.max
are set.
Current Behavior
If I let Chart.js auto scale the graph, it works just fine. However, my project involves using a date range picker which sets time.min
and time.max
to restrict the range of the graph, which causes half of the first and last bars to be cut off as there is no offset.
Auto scaling
With time.min
and time.max
Environment
- Chart.js version: 2.7.2
- Browser name and version: Chrome 67.0.3396.99
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:9 (2 by maintainers)
Top Results From Across the Web
How to set max and min value for Y axis - chart.js
As you can see max value (130) and min value (60) for Y axis are chosen automatically , I want max value =...
Read more >yAxis.offset | highcharts API Reference
When the axis' min option is set or a max extreme is set using axis.setExtremes() , the maxPadding will be ignored. Also the...
Read more >Axis | Vega-Lite
This determines a maximum offset value for axis titles. Default value: undefined . The minimum extent in pixels that axis ticks and labels...
Read more >Controlling Axis Features - SAS Help Center
The OFFSETMIN= and OFFSETMAX= axis options can be used to reserve an area at the minimum end of an axis, the maximum end,...
Read more >Axes | Chart.js
Each dataset is mapped to a scale for each axis (x, y or r) it requires. ... the min and max settings set...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@simonbrunel https://codepen.io/anon/pen/EGBEBq Does this work as a repro? Uncommenting time.min/max on lines 31/32 should reproduce the issue.
I’m having the same issue.
Elsewhere this was fixed by removing the timezone suffix, but for me these are simple ‘YYYY-MM-DD’ formats, so that doesn’t work for me.(edit: this refers to a slightly different issue related tooffset
)Update: One workaround of sorts is to set the time to 12:00(pm), e.g.
min: '2018-05-06 12:00:00'
. This will align the bars similar to how offset usually works. However, hovering at the sides of the Y-axes shows the partial bars are still there, just not visible.ticks.mirror
does not change this either.It looks like the X-axis is overlapped by the Y-axis? I don’t know. I’ve updated my repro.
My implementation is a bit complex but let me see what I can put together to demonstrate the issue - might not be until tomorrow