mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-20 23:26:53 +01:00
56 lines
735 B
JavaScript
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;
|
|
}
|
|
}
|