@@ -85,16 +85,14 @@ export class RadarChartRenderer extends LineRadarRenderer {
85
85
const minVal = this . mChart . getYChartMin ( ) ;
86
86
const angle = this . mChart . getRotationAngle ( ) ;
87
87
88
-
89
-
90
88
const entryCount = dataSet . getEntryCount ( ) ;
91
89
if ( ! this . mLineBuffer || this . mLineBuffer . length < Math . max ( entryCount * 2 , 2 ) * 2 ) {
92
90
this . mLineBuffer = Utils . createArrayBuffer ( Math . max ( entryCount * 2 , 2 ) * 2 ) ;
93
91
}
94
92
const float32arr = this . mLineBuffer ;
95
93
let index = 0 ;
96
94
for ( let j = 0 ; j < dataSet . getEntryCount ( ) ; j ++ ) {
97
- this . mRenderPaint . setColor ( dataSet . getColor ( j ) ) ;
95
+ this . mRenderPaint . setColor ( dataSet . getColor ( ) ) ;
98
96
99
97
const e = dataSet . getEntryForIndex ( j ) ;
100
98
const yProperty = dataSet . yProperty ;
@@ -104,20 +102,22 @@ export class RadarChartRenderer extends LineRadarRenderer {
104
102
if ( isNaN ( pOut . x ) ) continue ;
105
103
106
104
if ( ! hasMovedToPoint ) {
107
- float32arr [ index ++ ] = pOut . x ;
105
+ float32arr [ index ++ ] = pOut . x ;
108
106
float32arr [ index ++ ] = pOut . y ;
109
107
hasMovedToPoint = true ;
110
108
}
111
109
112
- float32arr [ index ++ ] = pOut . x ;
110
+ float32arr [ index ++ ] = pOut . x ;
113
111
float32arr [ index ++ ] = pOut . y ;
114
112
}
115
113
116
114
if ( dataSet . getEntryCount ( ) > mostEntries ) {
117
115
// if this is not the largest set, draw a line to the center before closing
118
- float32arr [ index ++ ] = center . x ;
116
+ float32arr [ index ++ ] = center . x ;
119
117
float32arr [ index ++ ] = center . y ;
120
118
}
119
+ float32arr [ index ++ ] = float32arr [ 0 ] ;
120
+ float32arr [ index ++ ] = float32arr [ 1 ] ;
121
121
const points = Utils . pointsFromBuffer ( float32arr ) ;
122
122
surface . setLines ( points , 0 , index ) ;
123
123
@@ -223,40 +223,48 @@ export class RadarChartRenderer extends LineRadarRenderer {
223
223
const center = this . mChart . getCenterOffsets ( ) ;
224
224
225
225
// draw the web lines that come from the center
226
- this . mWebPaint . setStrokeWidth ( this . mChart . getWebLineWidth ( ) ) ;
227
- this . mWebPaint . setColor ( this . mChart . getWebColor ( ) ) ;
228
- this . mWebPaint . setAlpha ( this . mChart . getWebAlpha ( ) ) ;
226
+ const lineWidth = this . mChart . getWebLineWidth ( ) ;
227
+ if ( lineWidth > 0 ) {
228
+ this . mWebPaint . setStrokeWidth ( this . mChart . getWebLineWidth ( ) ) ;
229
+ this . mWebPaint . setColor ( this . mChart . getWebColor ( ) ) ;
230
+ this . mWebPaint . setAlpha ( this . mChart . getWebAlpha ( ) ) ;
229
231
230
- const xIncrements = 1 + this . mChart . getSkipWebLineCount ( ) ;
231
- const maxEntryCount = this . mChart . getData ( ) . getMaxEntryCountSet ( ) . getEntryCount ( ) ;
232
+ const xIncrements = 1 + this . mChart . getSkipWebLineCount ( ) ;
233
+ const maxEntryCount = this . mChart . getData ( ) . getMaxEntryCountSet ( ) . getEntryCount ( ) ;
232
234
233
- const p : MPPointF = { x : 0 , y : 0 } ;
234
- for ( let i = 0 ; i < maxEntryCount ; i += xIncrements ) {
235
- Utils . getPosition ( center , this . mChart . getYRange ( ) * factor , sliceangle * i + rotationangle , p ) ;
235
+ const p : MPPointF = { x : 0 , y : 0 } ;
236
+ for ( let i = 0 ; i < maxEntryCount ; i += xIncrements ) {
237
+ Utils . getPosition ( center , this . mChart . getYRange ( ) * factor , sliceangle * i + rotationangle , p ) ;
236
238
237
- c . drawLine ( center . x , center . y , p . x , p . y , this . mWebPaint ) ;
239
+ c . drawLine ( center . x , center . y , p . x , p . y , this . mWebPaint ) ;
240
+ }
238
241
}
242
+
239
243
// MPPointF.recycleInstance(p);
240
244
241
245
// draw the inner-web
242
- this . mWebPaint . setStrokeWidth ( this . mChart . getWebLineWidthInner ( ) ) ;
243
- this . mWebPaint . setColor ( this . mChart . getWebColorInner ( ) ) ;
244
- this . mWebPaint . setAlpha ( this . mChart . getWebAlpha ( ) ) ;
246
+ const innerWidth = this . mChart . getWebLineWidthInner ( ) ;
247
+ if ( innerWidth > 0 ) {
248
+ this . mWebPaint . setStrokeWidth ( this . mChart . getWebLineWidthInner ( ) ) ;
249
+ this . mWebPaint . setColor ( this . mChart . getWebColorInner ( ) ) ;
250
+ this . mWebPaint . setAlpha ( this . mChart . getWebAlpha ( ) ) ;
245
251
246
- const labelCount = this . mChart . getYAxis ( ) . mEntryCount ;
252
+ const labelCount = this . mChart . getYAxis ( ) . mEntryCount ;
247
253
248
- const p1out : MPPointF = { x : 0 , y : 0 } ;
249
- const p2out : MPPointF = { x : 0 , y : 0 } ;
250
- for ( let j = 0 ; j < labelCount ; j ++ ) {
251
- for ( let i = 0 ; i < this . mChart . getData ( ) . getEntryCount ( ) ; i ++ ) {
252
- const r = ( this . mChart . getYAxis ( ) . mEntries [ j ] - this . mChart . getYChartMin ( ) ) * factor ;
254
+ const p1out : MPPointF = { x : 0 , y : 0 } ;
255
+ const p2out : MPPointF = { x : 0 , y : 0 } ;
256
+ for ( let j = 0 ; j < labelCount ; j ++ ) {
257
+ for ( let i = 0 ; i < this . mChart . getData ( ) . getEntryCount ( ) ; i ++ ) {
258
+ const r = ( this . mChart . getYAxis ( ) . mEntries [ j ] - this . mChart . getYChartMin ( ) ) * factor ;
253
259
254
- Utils . getPosition ( center , r , sliceangle * i + rotationangle , p1out ) ;
255
- Utils . getPosition ( center , r , sliceangle * ( i + 1 ) + rotationangle , p2out ) ;
260
+ Utils . getPosition ( center , r , sliceangle * i + rotationangle , p1out ) ;
261
+ Utils . getPosition ( center , r , sliceangle * ( i + 1 ) + rotationangle , p2out ) ;
256
262
257
- c . drawLine ( p1out . x , p1out . y , p2out . x , p2out . y , this . mWebPaint ) ;
263
+ c . drawLine ( p1out . x , p1out . y , p2out . x , p2out . y , this . mWebPaint ) ;
264
+ }
258
265
}
259
266
}
267
+
260
268
// MPPointF.recycleInstance(p1out);
261
269
// MPPointF.recycleInstance(p2out);
262
270
}
0 commit comments