Skip to content

Commit 53b7426

Browse files
committed
Cosmetic
1 parent 1f923ae commit 53b7426

File tree

5 files changed

+30
-42
lines changed

5 files changed

+30
-42
lines changed

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@ public interface ILineDataSet extends ILineRadarDataSet<Entry> {
1313

1414
/**
1515
* Returns the drawing mode for this line dataset
16-
*
17-
* @return
1816
*/
1917
LineDataSet.Mode getMode();
2018

2119
/**
2220
* Returns the intensity of the cubic lines (the effect intensity).
2321
* Max = 1f = very cubic, Min = 0.05f = low cubic effect, Default: 0.2f
24-
*
25-
* @return
2622
*/
2723
float getCubicIntensity();
2824

@@ -45,59 +41,42 @@ public interface ILineDataSet extends ILineRadarDataSet<Entry> {
4541
/**
4642
* Returns the color at the given index of the DataSet's circle-color array.
4743
* Performs a IndexOutOfBounds check by modulus.
48-
*
49-
* @param index
50-
* @return
5144
*/
5245
int getCircleColor(int index);
5346

5447
/**
5548
* Returns the number of colors in this DataSet's circle-color array.
56-
*
57-
* @return
5849
*/
5950
int getCircleColorCount();
6051

6152
/**
6253
* Returns true if drawing circles for this DataSet is enabled, false if not
63-
*
64-
* @return
6554
*/
6655
boolean isDrawCirclesEnabled();
6756

6857
/**
6958
* Returns the color of the inner circle (the circle-hole).
70-
*
71-
* @return
7259
*/
7360
int getCircleHoleColor();
7461

7562
/**
7663
* Returns true if drawing the circle-holes is enabled, false if not.
77-
*
78-
* @return
7964
*/
8065
boolean isDrawCircleHoleEnabled();
8166

8267
/**
8368
* Returns the DashPathEffect that is used for drawing the lines.
84-
*
85-
* @return
8669
*/
8770
DashPathEffect getDashPathEffect();
8871

8972
/**
9073
* Returns true if the dashed-line effect is enabled, false if not.
9174
* If the DashPathEffect object is null, also return false here.
92-
*
93-
* @return
9475
*/
9576
boolean isDashedLineEnabled();
9677

9778
/**
9879
* Returns the IFillFormatter that is set for this DataSet.
99-
*
100-
* @return
10180
*/
10281
IFillFormatter getFillFormatter();
10382
}

app/src/main/kotlin/info/appdev/chartexample/CubicLineChartActivity.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import android.widget.SeekBar
1212
import android.widget.SeekBar.OnSeekBarChangeListener
1313
import android.widget.TextView
1414
import androidx.core.content.ContextCompat
15+
import androidx.core.net.toUri
1516
import com.github.mikephil.charting.components.YAxis
1617
import com.github.mikephil.charting.data.Entry
1718
import com.github.mikephil.charting.data.LineData
@@ -22,7 +23,6 @@ import com.github.mikephil.charting.interfaces.datasets.ILineDataSet
2223
import info.appdev.chartexample.DataTools.Companion.getMuchValues
2324
import info.appdev.chartexample.databinding.ActivityLinechartBinding
2425
import info.appdev.chartexample.notimportant.DemoBase
25-
import androidx.core.net.toUri
2626

2727
class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener {
2828
private var tvX: TextView? = null
@@ -169,11 +169,11 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener {
169169
R.id.actionToggleFilled -> {
170170
val sets = binding.chart1.data!!.dataSets
171171

172-
for (iSet in sets) {
173-
val set = iSet as LineDataSet
174-
175-
if (set.isDrawFilledEnabled) set.setDrawFilled(false)
176-
else set.setDrawFilled(true)
172+
for (set in sets) {
173+
if (set.isDrawFilledEnabled)
174+
set.setDrawFilled(false)
175+
else
176+
set.setDrawFilled(true)
177177
}
178178
binding.chart1.invalidate()
179179
}
@@ -183,8 +183,10 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener {
183183

184184
for (iSet in sets) {
185185
val set = iSet as LineDataSet
186-
if (set.isDrawCirclesEnabled) set.setDrawCircles(false)
187-
else set.setDrawCircles(true)
186+
if (iSet.isDrawCirclesEnabled)
187+
set.setDrawCircles(false)
188+
else
189+
set.setDrawCircles(true)
188190
}
189191
binding.chart1.invalidate()
190192
}

app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ class DrawChartActivity : DemoBase(), OnChartValueSelectedListener, OnDrawListen
8181
R.id.actionToggleValues -> {
8282
val sets = binding.chart1.data!!.dataSets
8383

84-
for (iSet in sets) {
85-
val set = iSet as LineDataSet
84+
for (set in sets) {
8685
set.setDrawValues(!set.isDrawValuesEnabled)
8786
}
8887

@@ -136,7 +135,7 @@ class DrawChartActivity : DemoBase(), OnChartValueSelectedListener, OnDrawListen
136135

137136
/** callback when a DataSet has been drawn (when lifting the finger) */
138137
override fun onDrawFinished(dataSet: DataSet<*>) {
139-
Timber.i("DataSet drawn. " + dataSet.toSimpleString())
138+
Timber.i("DataSet drawn. ${dataSet.toSimpleString()}")
140139

141140
// prepare the legend again
142141
binding.chart1.data?.let { binding.chart1.legendRenderer.computeLegend(it) }

app/src/main/kotlin/info/appdev/chartexample/LineChartTimeActivity.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener {
120120
while (x < to) {
121121
val y: Float
122122
if (count == 100) // initial
123-
y = (valuesData[Math.round(x)])!!.toFloat() * 50 + 50
123+
y = (valuesData[x.roundToInt()])!!.toFloat() * 50 + 50
124124
else y = (Math.random() * 50 + 50).toFloat() // manually triggered
125125

126126
values.add(Entry(x, y)) // add one entry per hour
@@ -193,8 +193,10 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener {
193193

194194
for (iSet in sets) {
195195
val set = iSet as LineDataSet
196-
if (set.isDrawCirclesEnabled) set.setDrawCircles(false)
197-
else set.setDrawCircles(true)
196+
if (set.isDrawCirclesEnabled)
197+
set.setDrawCircles(false)
198+
else
199+
set.setDrawCircles(true)
198200
}
199201
chart!!.invalidate()
200202
}
@@ -204,8 +206,10 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener {
204206

205207
for (iSet in sets) {
206208
val set = iSet as LineDataSet
207-
if (set.mode == LineDataSet.Mode.CUBIC_BEZIER) set.mode = LineDataSet.Mode.LINEAR
208-
else set.mode = LineDataSet.Mode.CUBIC_BEZIER
209+
if (set.mode == LineDataSet.Mode.CUBIC_BEZIER)
210+
set.mode = LineDataSet.Mode.LINEAR
211+
else
212+
set.mode = LineDataSet.Mode.CUBIC_BEZIER
209213
}
210214
chart!!.invalidate()
211215
}
@@ -215,8 +219,10 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener {
215219

216220
for (iSet in sets) {
217221
val set = iSet as LineDataSet
218-
if (set.mode == LineDataSet.Mode.STEPPED) set.mode = LineDataSet.Mode.LINEAR
219-
else set.mode = LineDataSet.Mode.STEPPED
222+
if (set.mode == LineDataSet.Mode.STEPPED)
223+
set.mode = LineDataSet.Mode.LINEAR
224+
else
225+
set.mode = LineDataSet.Mode.STEPPED
220226
}
221227
chart!!.invalidate()
222228
}

app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestu
182182

183183
for (iSet in sets) {
184184
val set = iSet as LineDataSet
185-
if (set.isDrawCirclesEnabled) set.setDrawCircles(false)
186-
else set.setDrawCircles(true)
185+
if (set.isDrawCirclesEnabled)
186+
set.setDrawCircles(false)
187+
else
188+
set.setDrawCircles(true)
187189
}
188190
chart!!.invalidate()
189191
}
@@ -255,7 +257,7 @@ class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestu
255257
}
256258

257259
override fun onChartGestureStart(me: MotionEvent, lastPerformedGesture: ChartGesture?) {
258-
Timber.i("START, x: " + me.x + ", y: " + me.y)
260+
Timber.i("START, x: ${me.x}, y: ${me.y}")
259261
}
260262

261263
override fun onChartGestureEnd(me: MotionEvent, lastPerformedGesture: ChartGesture?) {

0 commit comments

Comments
 (0)