@@ -59,11 +59,6 @@ var defaultConfig = {
59
59
}
60
60
} ;
61
61
62
- function getValueCount ( scale ) {
63
- var opts = scale . options ;
64
- return opts . angleLines . display || opts . pointLabels . display ? scale . chart . data . labels . length : 0 ;
65
- }
66
-
67
62
function getTickBackdropHeight ( opts ) {
68
63
var tickOpts = opts . ticks ;
69
64
@@ -153,7 +148,7 @@ function fitWithPointLabels(scale) {
153
148
scale . ctx . font = plFont . string ;
154
149
scale . _pointLabelSizes = [ ] ;
155
150
156
- var valueCount = getValueCount ( scale ) ;
151
+ var valueCount = scale . chart . data . labels . length ;
157
152
for ( i = 0 ; i < valueCount ; i ++ ) {
158
153
pointPosition = scale . getPointPosition ( i , scale . drawingArea + 5 ) ;
159
154
textSize = measureLabelSize ( scale . ctx , plFont . lineHeight , scale . pointLabels [ i ] ) ;
@@ -234,7 +229,7 @@ function drawPointLabels(scale) {
234
229
ctx . font = plFont . string ;
235
230
ctx . textBaseline = 'middle' ;
236
231
237
- for ( var i = getValueCount ( scale ) - 1 ; i >= 0 ; i -- ) {
232
+ for ( var i = scale . chart . data . labels . length - 1 ; i >= 0 ; i -- ) {
238
233
// Extra pixels out for some label spacing
239
234
var extra = ( i === 0 ? tickBackdropHeight / 2 : 0 ) ;
240
235
var pointLabelPosition = scale . getPointPosition ( i , outerDistance + extra + 5 ) ;
@@ -255,7 +250,7 @@ function drawPointLabels(scale) {
255
250
function drawRadiusLine ( scale , gridLineOpts , radius , index ) {
256
251
var ctx = scale . ctx ;
257
252
var circular = gridLineOpts . circular ;
258
- var valueCount = getValueCount ( scale ) ;
253
+ var valueCount = scale . chart . data . labels . length ;
259
254
var lineColor = valueAtIndexOrDefault ( gridLineOpts . color , index - 1 ) ;
260
255
var lineWidth = valueAtIndexOrDefault ( gridLineOpts . lineWidth , index - 1 ) ;
261
256
var pointPosition ;
@@ -403,8 +398,9 @@ module.exports = LinearScaleBase.extend({
403
398
} ,
404
399
405
400
getIndexAngle : function ( index ) {
406
- var angleMultiplier = 360 / getValueCount ( this ) ;
407
- var options = this . chart . options || { } ;
401
+ var chart = this . chart ;
402
+ var angleMultiplier = 360 / chart . data . labels . length ;
403
+ var options = chart . options || { } ;
408
404
var startAngle = options . startAngle || 0 ;
409
405
410
406
// Start from the top instead of right, so remove a quarter of the circle
@@ -488,7 +484,7 @@ module.exports = LinearScaleBase.extend({
488
484
ctx . lineDashOffset = resolve ( [ angleLineOpts . borderDashOffset , gridLineOpts . borderDashOffset , 0.0 ] ) ;
489
485
}
490
486
491
- for ( i = getValueCount ( me ) - 1 ; i >= 0 ; i -- ) {
487
+ for ( i = me . chart . data . labels . length - 1 ; i >= 0 ; i -- ) {
492
488
offset = me . getDistanceFromCenterForValue ( opts . ticks . reverse ? me . min : me . max ) ;
493
489
position = me . getPointPosition ( i , offset ) ;
494
490
ctx . beginPath ( ) ;
0 commit comments