Skip to content

Commit 9eb2dc6

Browse files
committed
Kotlin several Datasets
1 parent e7e5e42 commit 9eb2dc6

31 files changed

+645
-819
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleDataSet.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import com.github.mikephil.charting.utils.convertDpToPixel
77

88
/**
99
* DataSet for the CandleStickChart.
10-
*
11-
* @author Philipp Jahoda
1210
*/
13-
class CandleDataSet(yVals: MutableList<CandleEntry?>?, label: String?) : LineScatterCandleRadarDataSet<CandleEntry?>(yVals, label), ICandleDataSet {
11+
class CandleDataSet(yVals: MutableList<CandleEntry?>?, label: String = "") : LineScatterCandleRadarDataSet<CandleEntry?>(yVals, label), ICandleDataSet {
1412
/**
1513
* the width of the shadow of the candle
1614
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.github.mikephil.charting.interfaces.datasets.ILineDataSet
1010
import com.github.mikephil.charting.utils.ColorTemplate
1111
import com.github.mikephil.charting.utils.convertDpToPixel
1212

13-
class LineDataSet(yVals: MutableList<Entry?>?, label: String?) : LineRadarDataSet<Entry?>(yVals, label), ILineDataSet {
13+
class LineDataSet(yVals: MutableList<Entry?>?, label: String = "") : LineRadarDataSet<Entry?>(yVals, label), ILineDataSet {
1414
/**
1515
* Drawing mode for this line dataset
1616
*/

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

Lines changed: 0 additions & 125 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package com.github.mikephil.charting.data
2+
3+
import android.graphics.Color
4+
import android.graphics.drawable.Drawable
5+
import com.github.mikephil.charting.interfaces.datasets.ILineRadarDataSet
6+
import com.github.mikephil.charting.utils.convertDpToPixel
7+
8+
/**
9+
* Base dataset for line and radar DataSets.
10+
*/
11+
abstract class LineRadarDataSet<T : Entry?>(yVals: MutableList<T?>?, label: String) : LineScatterCandleRadarDataSet<T?>(yVals, label), ILineRadarDataSet<T?> {
12+
// TODO: Move to using `Fill` class
13+
/**
14+
* the color that is used for filling the line surface
15+
*/
16+
private var mFillColor = Color.rgb(140, 234, 255)
17+
18+
/**
19+
* Sets the drawable to be used to fill the area below the line.
20+
*/
21+
/**
22+
* the drawable to be used for filling the line surface
23+
*/
24+
override var fillDrawable: Drawable? = null
25+
26+
/**
27+
* sets the alpha value (transparency) that is used for filling the line
28+
* surface (0-255), default: 85
29+
*/
30+
/**
31+
* transparency used for filling line surface
32+
*/
33+
override var fillAlpha: Int = 85
34+
35+
/**
36+
* the width of the drawn data lines
37+
*/
38+
private var mLineWidth = 2.5f
39+
40+
/**
41+
* if true, the data will also be drawn filled
42+
*/
43+
override var isDrawFilledEnabled: Boolean = false
44+
45+
override var fillColor: Int
46+
get() = mFillColor
47+
/**
48+
* Sets the color that is used for filling the area below the line.
49+
* Resets an eventually set "fillDrawable".
50+
*/
51+
set(color) {
52+
mFillColor = color
53+
this.fillDrawable = null
54+
}
55+
56+
override var lineWidth: Float
57+
get() = mLineWidth
58+
/**
59+
* set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE:
60+
* thinner line == better performance, thicker line == worse performance
61+
*/
62+
set(width) {
63+
var width = width
64+
if (width < 0.0f) width = 0.0f
65+
if (width > 10.0f) width = 10.0f
66+
mLineWidth = width.convertDpToPixel()
67+
}
68+
69+
override fun setDrawFilled(enabled: Boolean) {
70+
this.isDrawFilledEnabled = enabled
71+
}
72+
73+
protected fun copy(lineRadarDataSet: LineRadarDataSet<*>) {
74+
super.copy((lineRadarDataSet as BaseDataSet<*>?)!!)
75+
lineRadarDataSet.isDrawFilledEnabled = this.isDrawFilledEnabled
76+
lineRadarDataSet.fillAlpha = this.fillAlpha
77+
lineRadarDataSet.mFillColor = mFillColor
78+
lineRadarDataSet.fillDrawable = this.fillDrawable
79+
lineRadarDataSet.mLineWidth = mLineWidth
80+
}
81+
}

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

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)