-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathPieEntryDouble.kt
More file actions
59 lines (41 loc) · 2.1 KB
/
PieEntryDouble.kt
File metadata and controls
59 lines (41 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package info.appdev.charting.data
import android.annotation.SuppressLint
import android.graphics.drawable.Drawable
import timber.log.Timber
/**
* High-precision pie entry that stores the value as Double, extending [PieEntryFloat]
* so it works seamlessly in the existing pie chart rendering pipeline.
* Use [valueDouble] for full-precision access.
* Pie entries have no meaningful x-axis value.
*/
@SuppressLint("ParcelCreator")
open class PieEntryDouble : PieEntryFloat {
var valueDouble: Double = 0.0
override var y: Float
get() = valueDouble.toFloat()
set(value) { valueDouble = value.toDouble() }
@get:Deprecated("")
@set:Deprecated("")
@Suppress("DEPRECATION")
override var x: Float
get() {
Timber.i("Pie entries do not have x values")
return super.x
}
set(x) {
super.x = x
Timber.i("Pie entries do not have x values")
}
constructor(value: Double) : super(value.toFloat()) { valueDouble = value }
constructor(value: Double, data: Any?) : super(value.toFloat(), data) { valueDouble = value }
constructor(value: Double, icon: Drawable?) : super(value.toFloat(), icon) { valueDouble = value }
constructor(value: Double, icon: Drawable?, data: Any?) : super(value.toFloat(), icon, data) { valueDouble = value }
constructor(value: Double, label: String?) : super(value.toFloat(), label) { valueDouble = value }
constructor(value: Double, label: String?, data: Any?) : super(value.toFloat(), label, data) { valueDouble = value }
constructor(value: Double, label: String?, icon: Drawable?) : super(value.toFloat(), label, icon) { valueDouble = value }
constructor(value: Double, label: String?, icon: Drawable?, data: Any?) : super(value.toFloat(), label, icon, data) { valueDouble = value }
/** Full-precision value (same as [valueDouble]). */
val valuePrecise: Double get() = valueDouble
override fun copy(): PieEntryDouble = PieEntryDouble(valueDouble, label, data)
override fun toString(): String = "PieEntryDouble valueDouble=$valueDouble label=$label"
}