mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-10 10:16:50 +01:00
Make offsetGridLines consistent and add new offset scale option (#4545)
Add a new `offset` option to scales to add extra space at edges and remove the `includeOffset` argument from `getPixelForValue()` and `getPixelForTick()`. The bar controller now automatically calculates the bar width to avoid overlaps. When `offsetGridLines` is true, grid lines move to the left by one half of the tick interval, and labels don't move.
This commit is contained in:
committed by
Simon Brunel
parent
7e6b46253d
commit
7dc71d009b
@@ -76,7 +76,7 @@ module.exports = function(Chart) {
|
||||
|
||||
// Desired view properties
|
||||
_model: {
|
||||
x: reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex, me.chart.isCombo),
|
||||
x: reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex),
|
||||
y: reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex),
|
||||
// Appearance
|
||||
radius: reset ? 0 : custom.radius ? custom.radius : me.getRadius(data),
|
||||
|
||||
Reference in New Issue
Block a user