Skip to content

Commit 4260187

Browse files
committed
Code cosmetic
1 parent bdfbec1 commit 4260187

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/components/Legend.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ else if (wasStacked) {
811811
mNeededHeight = labelLineHeight
812812
* (float) (mCalculatedLineSizes.size())
813813
+ labelLineSpacing *
814-
(float) (mCalculatedLineSizes.size() == 0
814+
(float) (mCalculatedLineSizes.isEmpty()
815815
? 0
816816
: (mCalculatedLineSizes.size() - 1));
817817

MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public IFillFormatter getFillFormatter() {
408408
return mFillFormatter;
409409
}
410410

411-
public enum Mode {
411+
public enum Mode {
412412
LINEAR,
413413
STEPPED,
414414
CUBIC_BEZIER,

MPChartLib/src/main/java/com/github/mikephil/charting/highlight/ChartHighlighter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float
163163

164164
//noinspection unchecked
165165
List<Entry> entries = set.getEntriesForXValue(xVal);
166-
if (entries.size() == 0) {
166+
if (entries.isEmpty()) {
167167
// Try to find closest x-value and take all entries for that x-value
168168
final Entry closest = set.getEntryForXValue(xVal, Float.NaN, rounding);
169169
if (closest != null)
@@ -173,12 +173,12 @@ protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float
173173
}
174174
}
175175

176-
if (entries.size() == 0)
176+
if (entries.isEmpty())
177177
return highlights;
178178

179179
for (Entry e : entries) {
180180
MPPointD pixels = mChart.getTransformer(
181-
set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());
181+
set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());
182182

183183
highlights.add(new Highlight(
184184
e.getX(), e.getY(),

MPChartLib/src/main/java/com/github/mikephil/charting/highlight/HorizontalBarHighlighter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float
5252

5353
//noinspection unchecked
5454
List<Entry> entries = set.getEntriesForXValue(xVal);
55-
if (entries.size() == 0) {
55+
if (entries.isEmpty()) {
5656
// Try to find closest x-value and take all entries for that x-value
5757
final Entry closest = set.getEntryForXValue(xVal, Float.NaN, rounding);
5858
if (closest != null)
@@ -62,7 +62,7 @@ protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float
6262
}
6363
}
6464

65-
if (entries.size() == 0)
65+
if (entries.isEmpty())
6666
return highlights;
6767

6868
for (Entry e : entries) {

MPChartLib/src/main/java/com/github/mikephil/charting/highlight/PieRadarHighlighter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public abstract class PieRadarHighlighter<T extends PieRadarChartBase> implement
1616
/**
1717
* buffer for storing previously highlighted values
1818
*/
19-
protected List<Highlight> mHighlightBuffer = new ArrayList<Highlight>();
19+
protected List<Highlight> mHighlightBuffer = new ArrayList<>();
2020

2121
public PieRadarHighlighter(T chart) {
2222
this.mChart = chart;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ open class BarChartRenderer(
502502
continue
503503
}
504504

505-
val e = set.getEntryForXValue(high.x, high.y)
505+
val barEntry = set.getEntryForXValue(high.x, high.y)!!
506506

507-
if (!isInBoundsX(e, set)) {
507+
if (!isInBoundsX(barEntry, set)) {
508508
continue
509509
}
510510

@@ -513,27 +513,27 @@ open class BarChartRenderer(
513513
paintHighlight.color = set.highLightColor
514514
paintHighlight.alpha = set.highLightAlpha
515515

516-
val isStack = high.stackIndex >= 0 && e.isStacked
516+
val isStack = high.stackIndex >= 0 && barEntry.isStacked
517517

518518
val y1: Float
519519
val y2: Float
520520

521521
if (isStack) {
522522
if (chart.isHighlightFullBarEnabled) {
523-
y1 = e.positiveSum
524-
y2 = -e.negativeSum
523+
y1 = barEntry.positiveSum
524+
y2 = -barEntry.negativeSum
525525
} else {
526-
val range = e.ranges[high.stackIndex]
526+
val range = barEntry.ranges[high.stackIndex]
527527

528528
y1 = range?.from ?: 0f
529529
y2 = range?.to ?: 0f
530530
}
531531
} else {
532-
y1 = e.y
532+
y1 = barEntry.y
533533
y2 = 0f
534534
}
535535

536-
prepareBarHighlight(e.x, y1, y2, barData.barWidth / 2f, trans!!)
536+
prepareBarHighlight(barEntry.x, y1, y2, barData.barWidth / 2f, trans!!)
537537

538538
setHighlightDrawPos(high, barRect)
539539

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ open class BubbleChartRenderer(
195195

196196
if (set == null || !set.isHighlightEnabled) continue
197197

198-
val entry = set.getEntryForXValue(high.x, high.y)
198+
val bubbleEntry = set.getEntryForXValue(high.x, high.y)!!
199199

200-
if (entry.y != high.y) continue
200+
if (bubbleEntry.y != high.y) continue
201201

202-
if (!isInBoundsX(entry, set)) continue
202+
if (!isInBoundsX(bubbleEntry, set)) continue
203203

204204
val trans = chart.getTransformer(set.axisDependency)
205205

@@ -217,14 +217,14 @@ open class BubbleChartRenderer(
217217
).toFloat()
218218
val referenceSize = min(maxBubbleHeight.toDouble(), maxBubbleWidth.toDouble()).toFloat()
219219

220-
pointBuffer[0] = entry.x
221-
pointBuffer[1] = (entry.y) * phaseY
220+
pointBuffer[0] = bubbleEntry.x
221+
pointBuffer[1] = (bubbleEntry.y) * phaseY
222222
trans.pointValuesToPixel(pointBuffer)
223223

224224
high.setDraw(pointBuffer[0], pointBuffer[1])
225225

226226
val shapeHalf = getShapeSize(
227-
entry.size,
227+
bubbleEntry.size,
228228
set.maxSize,
229229
referenceSize,
230230
normalizeSize
@@ -238,7 +238,7 @@ open class BubbleChartRenderer(
238238

239239
if (!viewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf)) break
240240

241-
val originalColor = set.getColor(entry.x.toInt())
241+
val originalColor = set.getColor(bubbleEntry.x.toInt())
242242

243243
Color.RGBToHSV(
244244
Color.red(originalColor), Color.green(originalColor),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.graphics.Canvas
44
import android.graphics.Paint
55
import android.graphics.Paint.Align
66
import android.graphics.Path
7+
import androidx.core.graphics.withSave
78
import com.github.mikephil.charting.components.Legend
89
import com.github.mikephil.charting.components.Legend.LegendDirection
910
import com.github.mikephil.charting.components.Legend.LegendForm
@@ -20,7 +21,6 @@ import com.github.mikephil.charting.utils.Utils
2021
import com.github.mikephil.charting.utils.ViewPortHandler
2122
import java.util.Collections
2223
import kotlin.math.min
23-
import androidx.core.graphics.withSave
2424

2525
@Suppress("MemberVisibilityCanBePrivate")
2626
open class LegendRenderer(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.graphics.Canvas
44
import android.graphics.Color
55
import android.graphics.Paint
66
import android.graphics.Path
7+
import androidx.core.graphics.withSave
78
import com.github.mikephil.charting.animation.ChartAnimator
89
import com.github.mikephil.charting.charts.RadarChart
910
import com.github.mikephil.charting.highlight.Highlight
@@ -12,7 +13,6 @@ import com.github.mikephil.charting.utils.ColorTemplate
1213
import com.github.mikephil.charting.utils.MPPointF
1314
import com.github.mikephil.charting.utils.Utils
1415
import com.github.mikephil.charting.utils.ViewPortHandler
15-
import androidx.core.graphics.withSave
1616

1717
open class RadarChartRenderer(
1818
protected var chart: RadarChart, animator: ChartAnimator?,

0 commit comments

Comments
 (0)