From 80c5230b4e18b5f3748b00e8aa5fb1f472c415f4 Mon Sep 17 00:00:00 2001 From: Bret Marzolf Date: Tue, 21 Feb 2017 16:30:34 -0800 Subject: [PATCH] Fix #89 - fix gridline rendering when using non-numeric static labels --- src/Axis.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Axis.js b/src/Axis.js index b8cfc5b..558d05b 100644 --- a/src/Axis.js +++ b/src/Axis.js @@ -87,8 +87,9 @@ class AxisStruct { item: currentAxis, path: Pathjs().moveto(start).lineto(end).closepath(), ticks: ticks, - lines: ticks.map(c => { - const lineStart = {x: horizontal ? this.scale(c) + margin.left : xAxis.min + margin.left, y: horizontal ? yAxis.min + margin.top : this.scale(c) + margin.top} + lines: ticks.map((c,i) => { + let scaleBase = isNaN(c) ? i : c + const lineStart = {x: horizontal ? this.scale(scaleBase) + margin.left : xAxis.min + margin.left, y: horizontal ? yAxis.min + margin.top : this.scale(scaleBase) + margin.top} return Pathjs().moveto(lineStart).lineto(horizontal ? lineStart.x : xAxis.max + margin.left, horizontal ? yAxis.max + (margin.top - tailLength) : lineStart.y) },this) }