@@ -21,12 +21,16 @@ defaults._set('radar', {
2121 }
2222} ) ;
2323
24- function nextItem ( collection , index ) {
25- return index >= collection . length - 1 ? collection [ 0 ] : collection [ index + 1 ] ;
24+ function nextItem ( collection , index , loop ) {
25+ return index >= collection . length - 1
26+ ? loop ? collection [ 0 ] : collection [ index ]
27+ : collection [ index + 1 ] ;
2628}
2729
28- function previousItem ( collection , index ) {
29- return index <= 0 ? collection [ collection . length - 1 ] : collection [ index - 1 ] ;
30+ function previousItem ( collection , index , loop ) {
31+ return index <= 0
32+ ? loop ? collection [ collection . length - 1 ] : collection [ index ]
33+ : collection [ index - 1 ] ;
3034}
3135
3236module . exports = DatasetController . extend ( {
@@ -99,11 +103,14 @@ module.exports = DatasetController.extend({
99103 var line = meta . dataset ;
100104 var points = meta . data || [ ] ;
101105 var animationsDisabled = me . chart . _animationsDisabled ;
106+ var labels = meta . iScale . _getLabels ( ) ;
102107 var i , ilen ;
103108
104109 // Data
105110 line . points = points ;
106111 line . _loop = true ;
112+ line . _fullLoop = labels . length === points . length ;
113+
107114 // Model
108115 line . _model = me . _resolveDatasetElementOptions ( ) ;
109116
@@ -133,7 +140,6 @@ module.exports = DatasetController.extend({
133140 const options = me . _resolveDataElementOptions ( i ) ;
134141 const x = reset ? scale . xCenter : pointPosition . x ;
135142 const y = reset ? scale . yCenter : pointPosition . y ;
136- const r = pointPosition . r ;
137143
138144 // Utility
139145 point . _options = options ;
@@ -142,7 +148,7 @@ module.exports = DatasetController.extend({
142148 point . _model = {
143149 x,
144150 y,
145- r,
151+ r : pointPosition . r ,
146152 skip : isNaN ( x ) || isNaN ( y ) ,
147153 // Appearance
148154 radius : options . radius ,
@@ -176,13 +182,16 @@ module.exports = DatasetController.extend({
176182 updateBezierControlPoints : function ( ) {
177183 var me = this ;
178184 var meta = me . _cachedMeta ;
179- var lineModel = meta . dataset . _model ;
185+ var line = meta . dataset ;
186+ var lineModel = line . _model ;
187+ var spanGaps = lineModel . spanGaps ;
188+ var loop = spanGaps ? line . _loop : line . _fullLoop ;
180189 var area = me . chart . chartArea ;
181190 var points = meta . data || [ ] ;
182191 var i , ilen , model , controlPoints ;
183192
184193 // Only consider points that are drawn in case the spanGaps option is used
185- if ( meta . dataset . _model . spanGaps ) {
194+ if ( spanGaps ) {
186195 points = points . filter ( function ( pt ) {
187196 return ! pt . _model . skip ;
188197 } ) ;
@@ -195,9 +204,9 @@ module.exports = DatasetController.extend({
195204 for ( i = 0 , ilen = points . length ; i < ilen ; ++ i ) {
196205 model = points [ i ] . _model ;
197206 controlPoints = helpers . splineCurve (
198- previousItem ( points , i ) . _model ,
207+ previousItem ( points , i , loop ) . _model ,
199208 model ,
200- nextItem ( points , i ) . _model ,
209+ nextItem ( points , i , loop ) . _model ,
201210 lineModel . tension
202211 ) ;
203212
0 commit comments