@@ -68,10 +68,10 @@ open class YAxisRendererHorizontalBarChart(
68
68
69
69
val positions = transformedPositions
70
70
71
- paintAxisLabels!! .setTypeface(yAxis.typeface)
72
- paintAxisLabels!! .textSize = yAxis.textSize
73
- paintAxisLabels!! .color = yAxis.textColor
74
- paintAxisLabels!! .textAlign = Align .CENTER
71
+ paintAxisLabels.setTypeface(yAxis.typeface)
72
+ paintAxisLabels.textSize = yAxis.textSize
73
+ paintAxisLabels.color = yAxis.textColor
74
+ paintAxisLabels.textAlign = Align .CENTER
75
75
76
76
val baseYOffset = Utils .convertDpToPixel(2.5f )
77
77
val textHeight = Utils .calcTextHeight(paintAxisLabels, " Q" ).toFloat()
@@ -99,20 +99,20 @@ open class YAxisRendererHorizontalBarChart(
99
99
override fun renderAxisLine (c : Canvas ) {
100
100
if (! yAxis.isEnabled || ! yAxis.isDrawAxisLineEnabled) return
101
101
102
- paintAxisLine!! .color = yAxis.axisLineColor
103
- paintAxisLine!! .strokeWidth = yAxis.axisLineWidth
102
+ paintAxisLine.color = yAxis.axisLineColor
103
+ paintAxisLine.strokeWidth = yAxis.axisLineWidth
104
104
105
105
if (yAxis.axisDependency == AxisDependency .LEFT ) {
106
106
c.drawLine(
107
107
viewPortHandler.contentLeft(),
108
108
viewPortHandler.contentTop(), viewPortHandler.contentRight(),
109
- viewPortHandler.contentTop(), paintAxisLine!!
109
+ viewPortHandler.contentTop(), paintAxisLine
110
110
)
111
111
} else {
112
112
c.drawLine(
113
113
viewPortHandler.contentLeft(),
114
114
viewPortHandler.contentBottom(), viewPortHandler.contentRight(),
115
- viewPortHandler.contentBottom(), paintAxisLine!!
115
+ viewPortHandler.contentBottom(), paintAxisLine
116
116
)
117
117
}
118
118
}
@@ -124,9 +124,9 @@ open class YAxisRendererHorizontalBarChart(
124
124
* @param positions
125
125
*/
126
126
override fun drawYLabels (c : Canvas , fixedPosition : Float , positions : FloatArray , offset : Float ) {
127
- paintAxisLabels!! .setTypeface(yAxis.typeface)
128
- paintAxisLabels!! .textSize = yAxis.textSize
129
- paintAxisLabels!! .color = yAxis.textColor
127
+ paintAxisLabels.setTypeface(yAxis.typeface)
128
+ paintAxisLabels.textSize = yAxis.textSize
129
+ paintAxisLabels.color = yAxis.textColor
130
130
131
131
val from = if (yAxis.isDrawBottomYLabelEntryEnabled) 0 else 1
132
132
val to = if (yAxis.isDrawTopYLabelEntryEnabled)
@@ -143,7 +143,7 @@ open class YAxisRendererHorizontalBarChart(
143
143
text,
144
144
positions[i * 2 ],
145
145
fixedPosition - offset + xOffset,
146
- paintAxisLabels!!
146
+ paintAxisLabels
147
147
)
148
148
}
149
149
}
@@ -189,8 +189,8 @@ open class YAxisRendererHorizontalBarChart(
189
189
// draw zero line
190
190
val pos = transformer!! .getPixelForValues(0f , 0f )
191
191
192
- zeroLinePaint!! .color = yAxis.zeroLineColor
193
- zeroLinePaint!! .strokeWidth = yAxis.zeroLineWidth
192
+ zeroLinePaint.color = yAxis.zeroLineColor
193
+ zeroLinePaint.strokeWidth = yAxis.zeroLineWidth
194
194
195
195
val zeroLinePath = drawZeroLinePathBuffer
196
196
zeroLinePath.reset()
@@ -199,7 +199,7 @@ open class YAxisRendererHorizontalBarChart(
199
199
zeroLinePath.lineTo(pos.x.toFloat() - 1 , viewPortHandler.contentBottom())
200
200
201
201
// draw a path because lines don't support dashing on lower android versions
202
- c.drawPath(zeroLinePath, zeroLinePaint!! )
202
+ c.drawPath(zeroLinePath, zeroLinePaint)
203
203
204
204
}
205
205
}
@@ -208,7 +208,7 @@ open class YAxisRendererHorizontalBarChart(
208
208
protected var mRenderLimitLinesBuffer: FloatArray = FloatArray (4 )
209
209
210
210
init {
211
- limitLinePaint!! .textAlign = Align .LEFT
211
+ limitLinePaint.textAlign = Align .LEFT
212
212
}
213
213
214
214
/* *
@@ -251,24 +251,24 @@ open class YAxisRendererHorizontalBarChart(
251
251
limitLinePath.moveTo(pts[0 ], pts[1 ])
252
252
limitLinePath.lineTo(pts[2 ], pts[3 ])
253
253
254
- limitLinePaint!! .style = Paint .Style .STROKE
255
- limitLinePaint!! .color = l.lineColor
256
- limitLinePaint!! .setPathEffect(l.dashPathEffect)
257
- limitLinePaint!! .strokeWidth = l.lineWidth
254
+ limitLinePaint.style = Paint .Style .STROKE
255
+ limitLinePaint.color = l.lineColor
256
+ limitLinePaint.setPathEffect(l.dashPathEffect)
257
+ limitLinePaint.strokeWidth = l.lineWidth
258
258
259
- c.drawPath(limitLinePath, limitLinePaint!! )
259
+ c.drawPath(limitLinePath, limitLinePaint)
260
260
limitLinePath.reset()
261
261
262
262
val label = l.label
263
263
264
264
// if drawing the limit-value label is enabled
265
265
if (label != null && label != " " ) {
266
- limitLinePaint!! .style = l.textStyle
267
- limitLinePaint!! .setPathEffect(null )
268
- limitLinePaint!! .color = l.textColor
269
- limitLinePaint!! .setTypeface(l.typeface)
270
- limitLinePaint!! .strokeWidth = 0.5f
271
- limitLinePaint!! .textSize = l.textSize
266
+ limitLinePaint.style = l.textStyle
267
+ limitLinePaint.setPathEffect(null )
268
+ limitLinePaint.color = l.textColor
269
+ limitLinePaint.setTypeface(l.typeface)
270
+ limitLinePaint.strokeWidth = 0.5f
271
+ limitLinePaint.textSize = l.textSize
272
272
273
273
val xOffset = l.lineWidth + l.xOffset
274
274
val yOffset = Utils .convertDpToPixel(2f ) + l.yOffset
@@ -278,21 +278,21 @@ open class YAxisRendererHorizontalBarChart(
278
278
when (position) {
279
279
LimitLabelPosition .RIGHT_TOP -> {
280
280
val labelLineHeight = Utils .calcTextHeight(limitLinePaint, label).toFloat()
281
- limitLinePaint!! .textAlign = Align .LEFT
282
- c.drawText(label, pts[0 ] + xOffset, viewPortHandler.contentTop() + yOffset + labelLineHeight, limitLinePaint!! )
281
+ limitLinePaint.textAlign = Align .LEFT
282
+ c.drawText(label, pts[0 ] + xOffset, viewPortHandler.contentTop() + yOffset + labelLineHeight, limitLinePaint)
283
283
}
284
284
LimitLabelPosition .RIGHT_BOTTOM -> {
285
- limitLinePaint!! .textAlign = Align .LEFT
286
- c.drawText(label, pts[0 ] + xOffset, viewPortHandler.contentBottom() - yOffset, limitLinePaint!! )
285
+ limitLinePaint.textAlign = Align .LEFT
286
+ c.drawText(label, pts[0 ] + xOffset, viewPortHandler.contentBottom() - yOffset, limitLinePaint)
287
287
}
288
288
LimitLabelPosition .LEFT_TOP -> {
289
- limitLinePaint!! .textAlign = Align .RIGHT
289
+ limitLinePaint.textAlign = Align .RIGHT
290
290
val labelLineHeight = Utils .calcTextHeight(limitLinePaint, label).toFloat()
291
- c.drawText(label, pts[0 ] - xOffset, viewPortHandler.contentTop() + yOffset + labelLineHeight, limitLinePaint!! )
291
+ c.drawText(label, pts[0 ] - xOffset, viewPortHandler.contentTop() + yOffset + labelLineHeight, limitLinePaint)
292
292
}
293
293
else -> {
294
- limitLinePaint!! .textAlign = Align .RIGHT
295
- c.drawText(label, pts[0 ] - xOffset, viewPortHandler.contentBottom() - yOffset, limitLinePaint!! )
294
+ limitLinePaint.textAlign = Align .RIGHT
295
+ c.drawText(label, pts[0 ] - xOffset, viewPortHandler.contentBottom() - yOffset, limitLinePaint)
296
296
}
297
297
}
298
298
}
0 commit comments