From: Evert Timberg Date: Sat, 9 Jan 2016 19:42:55 +0000 (-0500) Subject: Make sure tick string could be null / undefined X-Git-Tag: v2.0.0~72^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1879%2Fhead;p=thirdparty%2FChart.js.git Make sure tick string could be null / undefined --- diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index a25857b9e..7ecdfa215 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -240,7 +240,7 @@ for (i = 0; i < this.getValueCount(); i++) { // 5px to space the text slightly out - similar to what we do in the draw function. pointPosition = this.getPointPosition(i, largestPossibleRadius); - textWidth = this.ctx.measureText(this.options.ticks.callback(this.pointLabels[i])).width + 5; + textWidth = this.ctx.measureText(this.pointLabels[i] ? this.pointLabels[i] : '').width + 5; if (i === 0 || i === this.getValueCount() / 2) { // If we're at index zero, or exactly the middle, we're at exactly the top/bottom // of the radar chart, so text will be aligned centrally, so we'll half it and compare @@ -424,7 +424,7 @@ ctx.textBaseline = 'top'; } - ctx.fillText(this.pointLabels[i], pointLabelPosition.x, pointLabelPosition.y); + ctx.fillText(this.pointLabels[i] ? this.pointLabels[i] : '', pointLabelPosition.x, pointLabelPosition.y); } } }