Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ else if (wasStacked) {
mNeededHeight = labelLineHeight
* (float) (mCalculatedLineSizes.size())
+ labelLineSpacing *
(float) (mCalculatedLineSizes.size() == 0
(float) (mCalculatedLineSizes.isEmpty()
? 0
: (mCalculatedLineSizes.size() - 1));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public IFillFormatter getFillFormatter() {
return mFillFormatter;
}

public enum Mode {
public enum Mode {
LINEAR,
STEPPED,
CUBIC_BEZIER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float

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

if (entries.size() == 0)
if (entries.isEmpty())
return highlights;

for (Entry e : entries) {
MPPointD pixels = mChart.getTransformer(
set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());
set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());

highlights.add(new Highlight(
e.getX(), e.getY(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float

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

if (entries.size() == 0)
if (entries.isEmpty())
return highlights;

for (Entry e : entries) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public abstract class PieRadarHighlighter<T extends PieRadarChartBase> implement
/**
* buffer for storing previously highlighted values
*/
protected List<Highlight> mHighlightBuffer = new ArrayList<Highlight>();
protected List<Highlight> mHighlightBuffer = new ArrayList<>();

public PieRadarHighlighter(T chart) {
this.mChart = chart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ open class BarChartRenderer(
continue
}

val e = set.getEntryForXValue(high.x, high.y)
val barEntry = set.getEntryForXValue(high.x, high.y)!!

if (!isInBoundsX(e, set)) {
if (!isInBoundsX(barEntry, set)) {
continue
}

Expand All @@ -513,27 +513,27 @@ open class BarChartRenderer(
paintHighlight.color = set.highLightColor
paintHighlight.alpha = set.highLightAlpha

val isStack = high.stackIndex >= 0 && e.isStacked
val isStack = high.stackIndex >= 0 && barEntry.isStacked

val y1: Float
val y2: Float

if (isStack) {
if (chart.isHighlightFullBarEnabled) {
y1 = e.positiveSum
y2 = -e.negativeSum
y1 = barEntry.positiveSum
y2 = -barEntry.negativeSum
} else {
val range = e.ranges[high.stackIndex]
val range = barEntry.ranges[high.stackIndex]

y1 = range?.from ?: 0f
y2 = range?.to ?: 0f
}
} else {
y1 = e.y
y1 = barEntry.y
y2 = 0f
}

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

setHighlightDrawPos(high, barRect)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ open class BubbleChartRenderer(

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

val entry = set.getEntryForXValue(high.x, high.y)
val bubbleEntry = set.getEntryForXValue(high.x, high.y)!!

if (entry.y != high.y) continue
if (bubbleEntry.y != high.y) continue

if (!isInBoundsX(entry, set)) continue
if (!isInBoundsX(bubbleEntry, set)) continue

val trans = chart.getTransformer(set.axisDependency)

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

pointBuffer[0] = entry.x
pointBuffer[1] = (entry.y) * phaseY
pointBuffer[0] = bubbleEntry.x
pointBuffer[1] = (bubbleEntry.y) * phaseY
trans.pointValuesToPixel(pointBuffer)

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

val shapeHalf = getShapeSize(
entry.size,
bubbleEntry.size,
set.maxSize,
referenceSize,
normalizeSize
Expand All @@ -238,7 +238,7 @@ open class BubbleChartRenderer(

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

val originalColor = set.getColor(entry.x.toInt())
val originalColor = set.getColor(bubbleEntry.x.toInt())

Color.RGBToHSV(
Color.red(originalColor), Color.green(originalColor),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Paint.Align
import android.graphics.Path
import androidx.core.graphics.withSave
import com.github.mikephil.charting.components.Legend
import com.github.mikephil.charting.components.Legend.LegendDirection
import com.github.mikephil.charting.components.Legend.LegendForm
Expand All @@ -20,7 +21,6 @@ import com.github.mikephil.charting.utils.Utils
import com.github.mikephil.charting.utils.ViewPortHandler
import java.util.Collections
import kotlin.math.min
import androidx.core.graphics.withSave

@Suppress("MemberVisibilityCanBePrivate")
open class LegendRenderer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import androidx.core.graphics.withSave
import com.github.mikephil.charting.animation.ChartAnimator
import com.github.mikephil.charting.charts.RadarChart
import com.github.mikephil.charting.highlight.Highlight
Expand All @@ -12,7 +13,6 @@ import com.github.mikephil.charting.utils.ColorTemplate
import com.github.mikephil.charting.utils.MPPointF
import com.github.mikephil.charting.utils.Utils
import com.github.mikephil.charting.utils.ViewPortHandler
import androidx.core.graphics.withSave

open class RadarChartRenderer(
protected var chart: RadarChart, animator: ChartAnimator?,
Expand Down
Loading