Skip to content

Commit f212ab5

Browse files
authored
Merge pull request #496 from AppDevNext/InterfaceChangeIsDrawValues
Interface change is draw values
2 parents a8e6c27 + 23cfac9 commit f212ab5

38 files changed

+103
-111
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,15 @@ abstract class BaseDataSet<T : Entry>() : IDataSet<T> {
319319
this.mDrawValues = enabled
320320
}
321321

322-
override fun isDrawValuesEnabled(): Boolean {
322+
override fun isDrawValues(): Boolean {
323323
return mDrawValues
324324
}
325325

326326
override fun setDrawIcons(enabled: Boolean) {
327327
mDrawIcons = enabled
328328
}
329329

330-
override fun isDrawIconsEnabled(): Boolean {
330+
override fun isDrawIcons(): Boolean {
331331
return mDrawIcons
332332
}
333333

MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IDataSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public interface IDataSet<T extends Entry> {
330330
/**
331331
* Returns true if y-value drawing is enabled, false if not
332332
*/
333-
boolean isDrawValuesEnabled();
333+
boolean isDrawValues();
334334

335335
/**
336336
* Set this to true to draw y-icons on the chart.
@@ -342,7 +342,7 @@ public interface IDataSet<T extends Entry> {
342342
/**
343343
* Returns true if y-icon drawing is enabled, false if not
344344
*/
345-
boolean isDrawIconsEnabled();
345+
boolean isDrawIcons();
346346

347347
/**
348348
* Offset of icons drawn on the chart.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,15 @@ open class BarChartRenderer(
314314
val entry = dataSet.getEntryForIndex(j / 4)
315315
val `val` = entry.y
316316

317-
if (dataSet.isDrawValuesEnabled) {
317+
if (dataSet.isDrawValues) {
318318
drawValue(
319319
canvas, dataSet.valueFormatter, `val`, entry, i, x,
320320
if (`val` >= 0) (buffer.buffer[j + 1] + posOffset) else (buffer.buffer[j + 3] + negOffset),
321321
dataSet.getValueTextColor(j / 4)
322322
)
323323
}
324324

325-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
325+
if (entry.icon != null && dataSet.isDrawIcons) {
326326
val icon = entry.icon
327327

328328
var px = x
@@ -372,7 +372,7 @@ open class BarChartRenderer(
372372
continue
373373
}
374374

375-
if (dataSet.isDrawValuesEnabled) {
375+
if (dataSet.isDrawValues) {
376376
drawValue(
377377
canvas, dataSet.valueFormatter, entry.y, entry, i, x,
378378
buffer.buffer[bufferIndex + 1] +
@@ -381,7 +381,7 @@ open class BarChartRenderer(
381381
)
382382
}
383383

384-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
384+
if (entry.icon != null && dataSet.isDrawIcons) {
385385
val icon = entry.icon
386386

387387
var px = x
@@ -454,7 +454,7 @@ open class BarChartRenderer(
454454
continue
455455
}
456456

457-
if (dataSet.isDrawValuesEnabled) {
457+
if (dataSet.isDrawValues) {
458458
drawValue(
459459
canvas,
460460
dataSet.valueFormatter,
@@ -467,7 +467,7 @@ open class BarChartRenderer(
467467
)
468468
}
469469

470-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
470+
if (entry.icon != null && dataSet.isDrawIcons) {
471471
val icon = entry.icon
472472

473473
icon?.let {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract class BarLineScatterCandleBubbleRenderer(animator: ChartAnimator, viewP
2020
* Returns true if the DataSet values should be drawn, false if not.
2121
*/
2222
protected fun shouldDrawValues(set: IDataSet<*>): Boolean {
23-
return set.isVisible() && (set.isDrawValuesEnabled() || set.isDrawIconsEnabled())
23+
return set.isVisible() && (set.isDrawValues() || set.isDrawIcons())
2424
}
2525

2626
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ open class BubbleChartRenderer(
146146

147147
val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)
148148

149-
if (dataSet.isDrawValuesEnabled) {
149+
if (dataSet.isDrawValues) {
150150
drawValue(
151151
canvas, dataSet.valueFormatter, entry.size, entry, i, x,
152152
y + (0.5f * lineHeight), valueTextColor
153153
)
154154
}
155155

156-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
156+
if (entry.icon != null && dataSet.isDrawIcons) {
157157
val icon = entry.icon
158158

159159
icon?.let {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ open class CandleStickChartRenderer(
250250

251251
val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)
252252

253-
if (dataSet.isDrawValuesEnabled) {
253+
if (dataSet.isDrawValues) {
254254
drawValue(
255255
canvas,
256256
dataSet.valueFormatter,
@@ -264,7 +264,7 @@ open class CandleStickChartRenderer(
264264
)
265265
}
266266

267-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
267+
if (entry.icon != null && dataSet.isDrawIcons) {
268268
val icon = entry.icon
269269

270270
icon?.let {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ open class HorizontalBarChartRenderer(
234234
negOffset = -negOffset - valueTextWidth
235235
}
236236

237-
if (dataSet.isDrawValuesEnabled) {
237+
if (dataSet.isDrawValues) {
238238
drawValue(
239239
canvas,
240240
formattedValue!!,
@@ -244,7 +244,7 @@ open class HorizontalBarChartRenderer(
244244
)
245245
}
246246

247-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
247+
if (entry.icon != null && dataSet.isDrawIcons) {
248248
val icon = entry.icon
249249

250250
var px = buffer.buffer[j + 2] + (if (`val` >= 0) posOffset else negOffset)
@@ -310,7 +310,7 @@ open class HorizontalBarChartRenderer(
310310
negOffset = -negOffset - valueTextWidth
311311
}
312312

313-
if (dataSet.isDrawValuesEnabled) {
313+
if (dataSet.isDrawValues) {
314314
drawValue(
315315
canvas, formattedValue!!,
316316
buffer.buffer[bufferIndex + 2]
@@ -319,7 +319,7 @@ open class HorizontalBarChartRenderer(
319319
)
320320
}
321321

322-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
322+
if (entry.icon != null && dataSet.isDrawIcons) {
323323
val icon = entry.icon
324324

325325
var px = (buffer.buffer[bufferIndex + 2]
@@ -410,11 +410,11 @@ open class HorizontalBarChartRenderer(
410410
continue
411411
}
412412

413-
if (dataSet.isDrawValuesEnabled) {
413+
if (dataSet.isDrawValues) {
414414
drawValue(canvas, formattedValue!!, x, y + halfTextHeight, color)
415415
}
416416

417-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
417+
if (entry.icon != null && dataSet.isDrawIcons) {
418418
val icon = entry.icon
419419

420420
icon?.let {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ open class LineChartRenderer(
8888
return
8989

9090
paintRender.strokeWidth = dataSet.lineWidth
91-
paintRender.setPathEffect(dataSet.dashPathEffect)
91+
paintRender.pathEffect = dataSet.dashPathEffect
9292

9393
when (dataSet.lineMode) {
9494
LineDataSet.Mode.LINEAR, LineDataSet.Mode.STEPPED -> drawLinear(canvas, dataSet)
@@ -97,7 +97,7 @@ open class LineChartRenderer(
9797
else -> drawLinear(canvas, dataSet)
9898
}
9999

100-
paintRender.setPathEffect(null)
100+
paintRender.pathEffect = null
101101
}
102102

103103
protected fun drawHorizontalBezier(dataSet: ILineDataSet) {
@@ -147,7 +147,7 @@ open class LineChartRenderer(
147147

148148
bitmapCanvas!!.drawPath(cubicPath, paintRender)
149149

150-
paintRender.setPathEffect(null)
150+
paintRender.pathEffect = null
151151
}
152152

153153
protected fun drawCubicBezier(dataSet: ILineDataSet) {
@@ -221,7 +221,7 @@ open class LineChartRenderer(
221221

222222
bitmapCanvas!!.drawPath(cubicPath, paintRender)
223223

224-
paintRender.setPathEffect(null)
224+
paintRender.pathEffect = null
225225
}
226226

227227
protected fun drawCubicFill(canvas: Canvas, dataSet: ILineDataSet, spline: Path, trans: Transformer, bounds: XBounds) {
@@ -379,7 +379,7 @@ open class LineChartRenderer(
379379
}
380380
}
381381

382-
paintRender.setPathEffect(null)
382+
paintRender.pathEffect = null
383383
}
384384

385385
protected var mGenerateFilledPathBuffer: Path = Path()
@@ -532,14 +532,14 @@ open class LineChartRenderer(
532532
val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)
533533

534534
if (entry != null) {
535-
if (dataSet.isDrawValuesEnabled) {
535+
if (dataSet.isDrawValues) {
536536
drawValue(
537537
canvas, dataSet.valueFormatter, entry.y, entry, i, x,
538538
y - valOffset, dataSet.getValueTextColor(j / 2)
539539
)
540540
}
541541

542-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
542+
if (entry.icon != null && dataSet.isDrawIcons) {
543543
val icon = entry.icon
544544

545545
icon?.let {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ open class PieChartRenderer(
397397
if (dataSet.entryCount == 0) {
398398
continue
399399
}
400-
val drawValues = dataSet.isDrawValuesEnabled
400+
val drawValues = dataSet.isDrawValues
401401
if (!drawValues && !drawEntryLabels) {
402402
continue
403403
}
@@ -586,7 +586,7 @@ open class PieChartRenderer(
586586
}
587587
}
588588

589-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
589+
if (entry.icon != null && dataSet.isDrawIcons) {
590590
val icon = entry.icon
591591

592592
val x = (labelRadius + iconsOffset.y) * sliceXBase + center.x

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ open class RadarChartRenderer(
156156
pOut
157157
)
158158

159-
if (dataSet.isDrawValuesEnabled) {
159+
if (dataSet.isDrawValues) {
160160
drawValue(
161161
canvas,
162162
dataSet.valueFormatter,
@@ -169,7 +169,7 @@ open class RadarChartRenderer(
169169
)
170170
}
171171

172-
if (entry.icon != null && dataSet.isDrawIconsEnabled) {
172+
if (entry.icon != null && dataSet.isDrawIcons) {
173173
val icon = entry.icon
174174

175175
Utils.getPosition(

0 commit comments

Comments
 (0)