check if grid lines can be drawn (#13860)

This commit is contained in:
Peter Pisljar 2017-09-11 15:12:34 +02:00 committed by GitHub
parent 7cc823c863
commit 036af4ef5c

View file

@ -39,14 +39,20 @@ export function VislibGridProvider() {
drawCategoryLines(svg, width, height) {
const axis = this._handler.categoryAxes[0];
axis.getScale().ticks().forEach(tick => {
if (!axis) return;
const ticks = axis.getScale().ticks;
if (!ticks) return;
ticks().forEach(tick => {
this.drawLine(svg, tick, axis, width, height);
});
}
drawValueLines(svg, width, height) {
const axis = this._handler.valueAxes.find(axis => axis.axisConfig.get('id') === this.get('valueAxis'));
axis.getScale().ticks().forEach(tick => {
if (!axis) return;
const ticks = axis.getScale().ticks;
if (!ticks) return;
ticks().forEach(tick => {
this.drawLine(svg, tick, axis, width, height);
});
}