Chart.js/src/controllers/controller.horizontalBar.js
Jukka Kurkela ce74eb76a1 Convert axis options from arrays to objects (#6773)
* Convert axis options from arrays to objects

* Updated all chart type defaults
* Throw errors when axis type or position are not specified
* Avoid raising unnecessary errors when merging options into the default configs

* Fix additional tests

* Ensure scale defaults are set if type is not explicitly defined

* Another step

* Include `scale` as `firstIDs.r`

* update docs

* Update for buildOrUpdateScales

* Update migration guide

* Add test back
2019-11-21 18:46:49 -05:00

63 lines
841 B
JavaScript

'use strict';
var BarController = require('./controller.bar');
var defaults = require('../core/core.defaults');
defaults._set('horizontalBar', {
hover: {
mode: 'index',
axis: 'y'
},
scales: {
x: {
type: 'linear',
position: 'bottom'
},
y: {
type: 'category',
position: 'left',
offset: true,
gridLines: {
offsetGridLines: true
}
}
},
elements: {
rectangle: {
borderSkipped: 'left'
}
},
tooltips: {
mode: 'index',
axis: 'y'
}
});
defaults._set('global', {
datasets: {
horizontalBar: {
categoryPercentage: 0.8,
barPercentage: 0.9
}
}
});
module.exports = BarController.extend({
/**
* @private
*/
_getValueScaleId: function() {
return this._cachedMeta.xAxisID;
},
/**
* @private
*/
_getIndexScaleId: function() {
return this._cachedMeta.yAxisID;
}
});