Files
Chart.js/src/controllers/controller.horizontalBar.js
Evert Timberg df63d10cd9 Update horizontal bar chart default tooltip mode (#7488)
Ensures that vertical and horizontal bar charts behave the same way
2020-09-01 11:30:15 -04:00

56 lines
735 B
JavaScript

import BarController from './controller.bar';
import defaults from '../core/core.defaults';
defaults.set('horizontalBar', {
hover: {
mode: 'index',
axis: 'y'
},
scales: {
x: {
type: 'linear',
beginAtZero: true
},
y: {
type: 'category',
offset: true,
gridLines: {
offsetGridLines: true
}
}
},
datasets: {
categoryPercentage: 0.8,
barPercentage: 0.9
},
elements: {
rectangle: {
borderSkipped: 'left'
}
},
tooltips: {
axis: 'y'
}
});
export default class HorizontalBarController extends BarController {
/**
* @protected
*/
getValueScaleId() {
return this._cachedMeta.xAxisID;
}
/**
* @protected
*/
getIndexScaleId() {
return this._cachedMeta.yAxisID;
}
}