]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Make sure tick string could be null / undefined 1879/head
authorEvert Timberg <evert.timberg@gmail.com>
Sat, 9 Jan 2016 19:42:55 +0000 (14:42 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Sat, 9 Jan 2016 19:42:55 +0000 (14:42 -0500)
src/scales/scale.radialLinear.js

index a25857b9e2961d12e1c5a716bc73fbf181842767..7ecdfa215ae3f216eaf0aee3b70c8f4b10c6c459 100644 (file)
                        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
                                                        ctx.textBaseline = 'top';
                                                }
 
-                                               ctx.fillText(this.pointLabels[i], pointLabelPosition.x, pointLabelPosition.y);
+                                               ctx.fillText(this.pointLabels[i] ? this.pointLabels[i] : '', pointLabelPosition.x, pointLabelPosition.y);
                                        }
                                }
                        }