Skip to content

Commit cf829c3

Browse files
committed
Cosmetic
1 parent 4a96a6a commit cf829c3

File tree

7 files changed

+47
-35
lines changed

7 files changed

+47
-35
lines changed

chartLib/src/main/kotlin/info/appdev/charting/charts/BarChart.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,19 @@ open class BarChart : BarLineChartBase<BarData>, BarDataProvider {
9595
return null
9696
} else {
9797
highlighter?.let {
98-
val h = it.getHighlight(x, y)
99-
if (h == null || !isHighlightFullBar)
100-
return h
98+
val highlight = it.getHighlight(x, y)
99+
if (highlight == null || !isHighlightFullBar)
100+
return highlight
101101

102102
// For isHighlightFullBarEnabled, remove stackIndex
103103
return Highlight(
104-
h.x, h.y,
105-
h.xPx, h.yPx,
106-
h.dataSetIndex, -1, h.axis
104+
x = highlight.x,
105+
y = highlight.y,
106+
xPx = highlight.xPx,
107+
yPx = highlight.yPx,
108+
dataSetIndex = highlight.dataSetIndex,
109+
stackIndex = -1,
110+
axis = highlight.axis
107111
)
108112
}
109113
}

chartLib/src/main/kotlin/info/appdev/charting/charts/CombinedChart.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,13 @@ open class CombinedChart : BarLineChartBase<CombinedData>, CombinedDataProvider
400400

401401
// For isHighlightFullBarEnabled, remove stackIndex
402402
return Highlight(
403-
highlight.x,
404-
highlight.y,
405-
highlight.xPx,
406-
highlight.yPx,
407-
highlight.dataSetIndex,
408-
-1,
409-
highlight.axis
403+
x = highlight.x,
404+
y = highlight.y,
405+
xPx = highlight.xPx,
406+
yPx = highlight.yPx,
407+
dataSetIndex = highlight.dataSetIndex,
408+
stackIndex = -1,
409+
axis = highlight.axis
410410
)
411411
}
412412
}

chartLib/src/main/kotlin/info/appdev/charting/highlight/BarHighlighter.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ open class BarHighlighter(barDataProvider: BarDataProvider) : ChartHighlighter<B
4949
val pixels = provider.getTransformer(set.axisDependency)!!.getPixelForValues(high.x, ranges[stackIndex].to)
5050

5151
val stackedHigh = Highlight(
52-
entry.x,
53-
entry.y,
54-
pixels.x.toFloat(),
55-
pixels.y.toFloat(),
56-
high.dataSetIndex,
57-
stackIndex,
58-
high.axis
52+
x = entry.x,
53+
y = entry.y,
54+
xPx = pixels.x.toFloat(),
55+
yPx = pixels.y.toFloat(),
56+
dataSetIndex = high.dataSetIndex,
57+
stackIndex = stackIndex,
58+
axis = high.axis
5959
)
6060

6161
PointD.recycleInstance(pixels)

chartLib/src/main/kotlin/info/appdev/charting/highlight/ChartHighlighter.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider<*>>(prote
114114
* An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex.
115115
*/
116116
@Suppress("SameParameterValue")
117-
protected open fun buildHighlights(set: IDataSet<*>, dataSetIndex: Int, xVal: Float, rounding: DataSet.Rounding?): MutableList<Highlight> {
117+
protected open fun buildHighlights(
118+
set: IDataSet<*>,
119+
dataSetIndex: Int,
120+
xVal: Float,
121+
rounding: DataSet.Rounding?
122+
): MutableList<Highlight> {
118123
val highlights = ArrayList<Highlight>()
119124

120125
var entries = set.getEntriesForXValue(xVal)
@@ -135,9 +140,12 @@ open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider<*>>(prote
135140

136141
highlights.add(
137142
Highlight(
138-
e.x, e.y,
139-
pixels.x.toFloat(), pixels.y.toFloat(),
140-
dataSetIndex, set.axisDependency
143+
x = e.x,
144+
y = e.y,
145+
xPx = pixels.x.toFloat(),
146+
yPx = pixels.y.toFloat(),
147+
dataSetIndex = dataSetIndex,
148+
axis = set.axisDependency
141149
)
142150
)
143151
}

chartLib/src/main/kotlin/info/appdev/charting/highlight/Highlight.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ class Highlight : Serializable {
108108
* selected
109109
*/
110110
constructor(x: Float, y: Float, xPx: Float, yPx: Float, dataSetIndex: Int, stackIndex: Int, axis: AxisDependency?) : this(
111-
x,
112-
y,
113-
xPx,
114-
yPx,
115-
dataSetIndex,
116-
axis
111+
x = x,
112+
y = y,
113+
xPx = xPx,
114+
yPx = yPx,
115+
dataSetIndex = dataSetIndex,
116+
axis = axis
117117
) {
118118
this.stackIndex = stackIndex
119119
}
@@ -144,6 +144,6 @@ class Highlight : Serializable {
144144
}
145145

146146
override fun toString(): String {
147-
return "Highlight, x:$x y:$y dataSetIndex:$dataSetIndex stackIndex:$stackIndex (only stacked bar entry)"
147+
return "Highlight, x:$x y:$y dataSetIndex:$dataSetIndex stackIndex:$stackIndex dataIndex:$dataIndex (only stacked bar entry)"
148148
}
149149
}

chartLib/src/main/kotlin/info/appdev/charting/highlight/PieRadarHighlighter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ abstract class PieRadarHighlighter<T : PieRadarChartBase<*>>(protected var chart
66
/**
77
* buffer for storing previously highlighted values
88
*/
9-
protected var mHighlightBuffer: MutableList<Highlight> = ArrayList()
9+
protected var highlightBuffer: MutableList<Highlight> = ArrayList()
1010

1111
override fun getHighlight(x: Float, y: Float): Highlight? {
1212
val touchDistanceToCenter = chartPieRadar.distanceToCenter(x, y)

chartLib/src/main/kotlin/info/appdev/charting/highlight/RadarHighlighter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ open class RadarHighlighter(chart: RadarChart) : PieRadarHighlighter<RadarChart>
3535
* runtime. Do not over-use in performance critical situations.
3636
*/
3737
protected fun getHighlightsAtIndex(index: Int): MutableList<Highlight> {
38-
mHighlightBuffer.clear()
38+
highlightBuffer.clear()
3939

4040
val phaseX = chartPieRadar.animator.phaseX
4141
val phaseY = chartPieRadar.animator.phaseY
@@ -56,9 +56,9 @@ open class RadarHighlighter(chart: RadarChart) : PieRadarHighlighter<RadarChart>
5656
sliceAngle * index * phaseX + chartPieRadar.rotationAngle, pOut
5757
)
5858

59-
mHighlightBuffer.add(Highlight(index.toFloat(), entry.y, pOut.x, pOut.y, i, dataSet.axisDependency))
59+
highlightBuffer.add(Highlight(index.toFloat(), entry.y, pOut.x, pOut.y, i, dataSet.axisDependency))
6060
}
6161
}
62-
return mHighlightBuffer
62+
return highlightBuffer
6363
}
6464
}

0 commit comments

Comments
 (0)