Skip to content

Commit 1ea1480

Browse files
committed
Cosmetic
1 parent d8232e8 commit 1ea1480

File tree

2 files changed

+48
-46
lines changed

2 files changed

+48
-46
lines changed

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

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,64 +13,66 @@
1313
*/
1414
public class RadarHighlighter extends PieRadarHighlighter<RadarChart> {
1515

16-
public RadarHighlighter(RadarChart chart) {
17-
super(chart);
18-
}
16+
public RadarHighlighter(RadarChart chart) {
17+
super(chart);
18+
}
1919

20-
@Override
21-
protected Highlight getClosestHighlight(int index, float x, float y) {
20+
@Override
21+
protected Highlight getClosestHighlight(int index, float x, float y) {
2222

23-
List<Highlight> highlights = getHighlightsAtIndex(index);
23+
List<Highlight> highlights = getHighlightsAtIndex(index);
2424

25-
float distanceToCenter = mChart.distanceToCenter(x, y) / mChart.getFactor();
25+
float distanceToCenter = mChart.distanceToCenter(x, y) / mChart.getFactor();
2626

27-
Highlight closest = null;
28-
float distance = Float.MAX_VALUE;
27+
Highlight closest = null;
28+
float distance = Float.MAX_VALUE;
2929

30-
for (int i = 0; i < highlights.size(); i++) {
30+
for (int i = 0; i < highlights.size(); i++) {
3131

32-
Highlight high = highlights.get(i);
32+
Highlight high = highlights.get(i);
3333

34-
float cdistance = Math.abs(high.getY() - distanceToCenter);
35-
if (cdistance < distance) {
36-
closest = high;
37-
distance = cdistance;
38-
}
39-
}
34+
float cdistance = Math.abs(high.getY() - distanceToCenter);
35+
if (cdistance < distance) {
36+
closest = high;
37+
distance = cdistance;
38+
}
39+
}
4040

41-
return closest;
42-
}
43-
/**
44-
* Returns an array of Highlight objects for the given index. The Highlight
45-
* objects give information about the value at the selected index and the
46-
* DataSet it belongs to. INFORMATION: This method does calculations at
47-
* runtime. Do not over-use in performance critical situations.
48-
*/
49-
protected List<Highlight> getHighlightsAtIndex(int index) {
41+
return closest;
42+
}
5043

51-
mHighlightBuffer.clear();
44+
/**
45+
* Returns an array of Highlight objects for the given index. The Highlight
46+
* objects give information about the value at the selected index and the
47+
* DataSet it belongs to. INFORMATION: This method does calculations at
48+
* runtime. Do not over-use in performance critical situations.
49+
*/
50+
protected List<Highlight> getHighlightsAtIndex(int index) {
5251

53-
float phaseX = mChart.getAnimator().getPhaseX();
54-
float phaseY = mChart.getAnimator().getPhaseY();
55-
float sliceangle = mChart.getSliceAngle();
56-
float factor = mChart.getFactor();
52+
mHighlightBuffer.clear();
5753

58-
MPPointF pOut = MPPointF.getInstance(0,0);
59-
for (int i = 0; i < mChart.getData().getDataSetCount(); i++) {
54+
float phaseX = mChart.getAnimator().getPhaseX();
55+
float phaseY = mChart.getAnimator().getPhaseY();
56+
float sliceangle = mChart.getSliceAngle();
57+
float factor = mChart.getFactor();
6058

61-
IDataSet<?> dataSet = mChart.getData().getDataSetByIndex(i);
59+
MPPointF pOut = MPPointF.getInstance(0, 0);
60+
for (int i = 0; i < mChart.getData().getDataSetCount(); i++) {
6261

63-
final Entry entry = dataSet.getEntryForIndex(index);
62+
IDataSet<?> dataSet = mChart.getData().getDataSetByIndex(i);
6463

65-
float y = (entry.getY() - mChart.getYChartMin());
64+
final Entry entry = dataSet.getEntryForIndex(index);
6665

67-
Utils.getPosition(
68-
mChart.getCenterOffsets(), y * factor * phaseY,
69-
sliceangle * index * phaseX + mChart.getRotationAngle(), pOut);
66+
float y = (entry.getY() - mChart.getYChartMin());
7067

71-
mHighlightBuffer.add(new Highlight(index, entry.getY(), pOut.x, pOut.y, i, dataSet.getAxisDependency()));
72-
}
68+
Utils.getPosition(
69+
mChart.getCenterOffsets(), y * factor * phaseY,
70+
sliceangle * index * phaseX + mChart.getRotationAngle(), pOut
71+
);
7372

74-
return mHighlightBuffer;
75-
}
73+
mHighlightBuffer.add(new Highlight(index, entry.getY(), pOut.x, pOut.y, i, dataSet.getAxisDependency()));
74+
}
75+
76+
return mHighlightBuffer;
77+
}
7678
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class XAxisRendererRadarChart(viewPortHandler: ViewPortHandler, xAxis: XAxis, pr
1515
val labelRotationAngleDegrees = xAxis.labelRotationAngle
1616
val drawLabelAnchor = MPPointF.getInstance(0.5f, 0.25f)
1717

18-
paintAxisLabels!!.setTypeface(xAxis.typeface)
19-
paintAxisLabels!!.textSize = xAxis.textSize
20-
paintAxisLabels!!.color = xAxis.textColor
18+
paintAxisLabels.typeface = xAxis.typeface
19+
paintAxisLabels.textSize = xAxis.textSize
20+
paintAxisLabels.color = xAxis.textColor
2121

2222
val sliceAngle = chart.sliceAngle
2323

0 commit comments

Comments
 (0)