Skip to content

Commit 1e51cbf

Browse files
authored
Merge pull request #352 from AppDevNext/BarRendererKotlin
Bar renderer kotlin
2 parents 809ee77 + f20d50d commit 1e51cbf

23 files changed

+1709
-1894
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BarChartRenderer.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ open class BarChartRenderer(
8888
private val barShadowRectBuffer = RectF()
8989

9090
init {
91-
highlightPaint = Paint(Paint.ANTI_ALIAS_FLAG)
92-
highlightPaint.style = Paint.Style.FILL
93-
highlightPaint.color = Color.rgb(0, 0, 0)
91+
paintHighlight = Paint(Paint.ANTI_ALIAS_FLAG)
92+
paintHighlight.style = Paint.Style.FILL
93+
paintHighlight.color = Color.rgb(0, 0, 0)
9494
// set alpha after color
95-
highlightPaint.alpha = 120
95+
paintHighlight.alpha = 120
9696

9797
shadowPaint = Paint(Paint.ANTI_ALIAS_FLAG)
9898
shadowPaint.style = Paint.Style.FILL
@@ -170,7 +170,7 @@ open class BarChartRenderer(
170170
val isInverted = chart.isInverted(dataSet.axisDependency)
171171

172172
if (isSingleColor) {
173-
renderPaint.color = dataSet.color
173+
paintRender.color = dataSet.color
174174
}
175175

176176
var j = 0
@@ -189,13 +189,13 @@ open class BarChartRenderer(
189189
if (!isSingleColor) {
190190
// Set the color for the currently drawn value. If the index
191191
// is out of bounds, reuse colors.
192-
renderPaint.color = dataSet.getColor(pos)
192+
paintRender.color = dataSet.getColor(pos)
193193
}
194194

195195
if (isCustomFill) {
196196
dataSet.getFill(pos)
197197
.fillRect(
198-
c, renderPaint,
198+
c, paintRender,
199199
buffer.buffer[j],
200200
buffer.buffer[j + 1],
201201
buffer.buffer[j + 2],
@@ -209,12 +209,12 @@ open class BarChartRenderer(
209209
RectF(
210210
buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
211211
buffer.buffer[j + 3]
212-
), roundedBarRadius, roundedBarRadius, renderPaint
212+
), roundedBarRadius, roundedBarRadius, paintRender
213213
)
214214
} else {
215215
c.drawRect(
216216
buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
217-
buffer.buffer[j + 3], renderPaint
217+
buffer.buffer[j + 3], paintRender
218218
)
219219
}
220220
}
@@ -277,7 +277,7 @@ open class BarChartRenderer(
277277

278278
// calculate the correct offset depending on the draw position of
279279
// the value
280-
val valueTextHeight = Utils.calcTextHeight(mValuePaint, "8").toFloat()
280+
val valueTextHeight = Utils.calcTextHeight(paintValues, "8").toFloat()
281281
posOffset = (if (drawValueAboveBar) -valueOffsetPlus else valueTextHeight + valueOffsetPlus)
282282
negOffset = (if (drawValueAboveBar) valueTextHeight + valueOffsetPlus else -valueOffsetPlus)
283283

@@ -512,8 +512,8 @@ open class BarChartRenderer(
512512

513513
val trans = chart.getTransformer(set.axisDependency)
514514

515-
highlightPaint.color = set.highLightColor
516-
highlightPaint.alpha = set.highLightAlpha
515+
paintHighlight.color = set.highLightColor
516+
paintHighlight.alpha = set.highLightAlpha
517517

518518
val isStack = if (high.stackIndex >= 0 && e.isStacked) true else false
519519

@@ -540,9 +540,9 @@ open class BarChartRenderer(
540540
setHighlightDrawPos(high, barRect)
541541

542542
if (drawRoundedBars) {
543-
c.drawRoundRect(RectF(barRect), roundedBarRadius, roundedBarRadius, highlightPaint)
543+
c.drawRoundRect(RectF(barRect), roundedBarRadius, roundedBarRadius, paintHighlight)
544544
} else {
545-
c.drawRect(barRect, highlightPaint)
545+
c.drawRect(barRect, paintHighlight)
546546
}
547547
}
548548
}

MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BarLineScatterCandleBubbleRenderer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
99
import com.github.mikephil.charting.utils.ViewPortHandler;
1010

11-
/**
12-
* Created by Philipp Jahoda on 09/06/16.
13-
*/
1411
public abstract class BarLineScatterCandleBubbleRenderer extends DataRenderer {
1512

1613
/**

MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BubbleChartRenderer.java

Lines changed: 0 additions & 277 deletions
This file was deleted.

0 commit comments

Comments
 (0)