Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions chartLib/src/main/kotlin/info/appdev/charting/components/Legend.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import info.appdev.charting.utils.Utils
import info.appdev.charting.utils.ViewPortHandler
import info.appdev.charting.utils.calcTextHeight
import info.appdev.charting.utils.convertDpToPixel
import java.lang.Float
import kotlin.Array
import kotlin.Boolean
import kotlin.IntArray
Expand Down Expand Up @@ -126,12 +125,12 @@ class Legend() : ComponentBase() {
/**
* the size of the legend forms/shapes
*/
var formSize: kotlin.Float = 8f
var formSize: Float = 8f

/**
* the size of the legend forms/shapes
*/
var formLineWidth: kotlin.Float = 3f
var formLineWidth: Float = 3f

/**
* Line dash path effect used for shapes that consist of lines.
Expand All @@ -141,24 +140,24 @@ class Legend() : ComponentBase() {
/**
* the space between the legend entries on a horizontal axis, default 6f
*/
var xEntrySpace: kotlin.Float = 6f
var xEntrySpace: Float = 6f

/**
* the space between the legend entries on a vertical axis, default 5f
*/
var yEntrySpace: kotlin.Float = 0f
var yEntrySpace: Float = 0f

/**
* the space between the legend entries on a vertical axis, default 2f
* private float mYEntrySpace = 2f; / ** the space between the form and the
* actual label/text
*/
var formToTextSpace: kotlin.Float = 5f
var formToTextSpace: Float = 5f

/**
* the space that should be left between stacked forms
*/
var stackSpace: kotlin.Float = 3f
var stackSpace: Float = 3f

/**
* The maximum relative size out of the whole chart view. / If the legend is
Expand All @@ -168,7 +167,7 @@ class Legend() : ComponentBase() {
* piechart, then this defines the size of the rectangular bounds out of the
* size of the "hole". / default: 0.95f (95%)
*/
var maxSizePercent: kotlin.Float = 0.95f
var maxSizePercent: Float = 0.95f

/**
* Constructor. Provide entries for the legend.
Expand All @@ -190,13 +189,13 @@ class Legend() : ComponentBase() {
*
* @param p the paint object used for rendering the text
*/
fun getMaximumEntryWidth(p: Paint): kotlin.Float {
fun getMaximumEntryWidth(p: Paint): Float {
var max = 0f
var maxFormSize = 0f
val formToTextSpace = formToTextSpace.convertDpToPixel()

for (entry in this.entries) {
val formSize = (if (Float.isNaN(entry.formSize))
val formSize = (if (entry.formSize.isNaN())
this.formSize
else
entry.formSize).convertDpToPixel()
Expand All @@ -217,7 +216,7 @@ class Legend() : ComponentBase() {
*
* @param p the paint object used for rendering the text
*/
fun getMaximumEntryHeight(p: Paint): kotlin.Float {
fun getMaximumEntryHeight(p: Paint): Float {
var max = 0f

for (entry in this.entries) {
Expand Down Expand Up @@ -311,18 +310,18 @@ class Legend() : ComponentBase() {
* the total width of the legend (needed width space)
*/
@JvmField
var neededWidth: kotlin.Float = 0f
var neededWidth: Float = 0f

/**
* the total height of the legend (needed height space)
*/
@JvmField
var neededHeight: kotlin.Float = 0f
var neededHeight: Float = 0f

@JvmField
var mTextHeightMax: kotlin.Float = 0f
var mTextHeightMax: Float = 0f

var mTextWidthMax: kotlin.Float = 0f
var mTextWidthMax: Float = 0f

/**
* If this is set, then word wrapping the legend is enabled. This means the
Expand Down Expand Up @@ -383,7 +382,7 @@ class Legend() : ComponentBase() {
while (i < entryCount) {
val e = entries[i]
val drawingForm = e.form != LegendForm.NONE
val formSize = if (Float.isNaN(e.formSize))
val formSize = if (e.formSize.isNaN())
defaultFormSize
else
e.formSize.convertDpToPixel()
Expand Down Expand Up @@ -444,7 +443,7 @@ class Legend() : ComponentBase() {
while (i < entryCount) {
val e = entries[i]
val drawingForm = e.form != LegendForm.NONE
val formSize = if (Float.isNaN(e.formSize))
val formSize = if (e.formSize.isNaN())
defaultFormSize
else
e.formSize.convertDpToPixel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package info.appdev.charting.data
import android.graphics.Color
import info.appdev.charting.interfaces.datasets.IBarDataSet
import info.appdev.charting.utils.Fill
import java.lang.Float
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
Expand Down Expand Up @@ -137,7 +136,7 @@ open class BarDataSet(yVals: MutableList<BarEntry>, label: String) : BarLineScat
}

override fun calcMinMax(entry: BarEntry) {
if (!Float.isNaN(entry.y)) {
if (!entry.y.isNaN()) {
if (entry.yVals == null) {
if (entry.y < yMin) yMin = entry.y

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package info.appdev.charting.data

import android.util.Log
import info.appdev.charting.components.YAxis
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet
import timber.log.Timber
import java.lang.Float
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
Expand Down Expand Up @@ -152,7 +150,7 @@ class CombinedData : BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleD
val entries = data.getDataSetByIndex(highlight.dataSetIndex)!!
.getEntriesForXValue(highlight.x)
for (entry in entries!!) if (entry.y == highlight.y ||
Float.isNaN(highlight.y)
highlight.y.isNaN()
) return entry

return null
Expand Down Expand Up @@ -209,7 +207,7 @@ class CombinedData : BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleD
}

@Deprecated("")
override fun removeEntry(xValue: kotlin.Float, dataSetIndex: Int): Boolean {
override fun removeEntry(xValue: Float, dataSetIndex: Int): Boolean {
Timber.e("removeEntry(...) not supported for CombinedData")
return false
}
Expand Down
25 changes: 12 additions & 13 deletions chartLib/src/main/kotlin/info/appdev/charting/data/DataSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package info.appdev.charting.data

import timber.log.Timber
import java.io.Serializable
import java.lang.Float
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
Expand All @@ -22,25 +21,25 @@ abstract class DataSet<T : Entry>(
/**
* maximum y-value in the value array
*/
override var yMax: kotlin.Float = -Float.MAX_VALUE
override var yMax: Float = -Float.MAX_VALUE
protected set

/**
* minimum y-value in the value array
*/
override var yMin: kotlin.Float = Float.MAX_VALUE
override var yMin: Float = Float.MAX_VALUE
protected set

/**
* maximum x-value in the value array
*/
override var xMax: kotlin.Float = -Float.MAX_VALUE
override var xMax: Float = -Float.MAX_VALUE
protected set

/**
* minimum x-value in the value array
*/
override var xMin: kotlin.Float = Float.MAX_VALUE
override var xMin: Float = Float.MAX_VALUE
protected set


Expand Down Expand Up @@ -72,7 +71,7 @@ abstract class DataSet<T : Entry>(
}
}

override fun calcMinMaxY(fromX: kotlin.Float, toX: kotlin.Float) {
override fun calcMinMaxY(fromX: Float, toX: Float) {
this.yMax = -Float.MAX_VALUE
this.yMin = Float.MAX_VALUE

Expand Down Expand Up @@ -179,7 +178,7 @@ abstract class DataSet<T : Entry>(

override fun addEntryOrdered(entry: T) {
if (mEntries == null) {
mEntries = ArrayList<T>()
mEntries = ArrayList()
}

calcMinMax(entry)
Expand All @@ -200,7 +199,7 @@ abstract class DataSet<T : Entry>(
override fun addEntry(entry: T): Boolean {
var values = this.entries
if (values == null) {
values = ArrayList<T>()
values = ArrayList()
}

calcMinMax(entry)
Expand Down Expand Up @@ -229,15 +228,15 @@ abstract class DataSet<T : Entry>(
}


override fun getEntryForXValue(xValue: kotlin.Float, closestToY: kotlin.Float, rounding: Rounding?): T? {
override fun getEntryForXValue(xValue: Float, closestToY: Float, rounding: Rounding?): T? {
val index = getEntryIndex(xValue, closestToY, rounding)
if (index > -1) {
return mEntries!![index]
}
return null
}

override fun getEntryForXValue(xValue: kotlin.Float, closestToY: kotlin.Float): T? {
override fun getEntryForXValue(xValue: Float, closestToY: Float): T? {
return getEntryForXValue(xValue, closestToY, Rounding.CLOSEST)
}

Expand All @@ -252,7 +251,7 @@ abstract class DataSet<T : Entry>(
return mEntries!![index]
}

override fun getEntryIndex(xValue: kotlin.Float, closestToY: kotlin.Float, rounding: Rounding?): Int {
override fun getEntryIndex(xValue: Float, closestToY: Float, rounding: Rounding?): Int {
if (mEntries == null || mEntries!!.isEmpty()) {
return -1
}
Expand Down Expand Up @@ -311,7 +310,7 @@ abstract class DataSet<T : Entry>(
}

// Search by closest to y-value
if (!Float.isNaN(closestToY)) {
if (!closestToY.isNaN()) {
while (closest > 0 && mEntries!![closest - 1].x == closestXValue) {
closest -= 1
}
Expand Down Expand Up @@ -342,7 +341,7 @@ abstract class DataSet<T : Entry>(
return closest
}

override fun getEntriesForXValue(xValue: kotlin.Float): MutableList<T> {
override fun getEntriesForXValue(xValue: Float): MutableList<T> {
val entries: MutableList<T> = mutableListOf()

var low = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ open class LegendRenderer(
while (i < entries.size) {
val entry = entries[i]
val drawingForm = entry.form != LegendForm.NONE
val formSize = if (java.lang.Float.isNaN(entry.formSize))
val formSize = if (entry.formSize.isNaN())
defaultFormSize
else
entry.formSize.convertDpToPixel()
Expand Down Expand Up @@ -369,7 +369,7 @@ open class LegendRenderer(
while (i < entries.size) {
val entry = entries[i]
val drawingForm = entry.form != LegendForm.NONE
val formSize = if (java.lang.Float.isNaN(entry.formSize)) defaultFormSize else entry.formSize.convertDpToPixel()
val formSize = if (entry.formSize.isNaN()) defaultFormSize else entry.formSize.convertDpToPixel()

var posX = originPosX

Expand Down Expand Up @@ -451,7 +451,7 @@ open class LegendRenderer(
formPaint.color = entry.formColor

val formSize = (
if (java.lang.Float.isNaN(entry.formSize))
if (entry.formSize.isNaN())
legend.formSize
else
entry.formSize
Expand All @@ -473,7 +473,7 @@ open class LegendRenderer(

LegendForm.LINE -> {
val formLineWidth = (
if (java.lang.Float.isNaN(entry.formLineWidth))
if (entry.formLineWidth.isNaN())
legend.formLineWidth
else
entry.formLineWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ open class RadarChartRenderer(
sliceAngle * j * phaseX + chart.rotationAngle, pOut
)
}
if (java.lang.Float.isNaN(pOut.x)) continue
if (pOut.x.isNaN())
continue

if (!hasMovedToPoint) {
surface.moveTo(pOut.x, pOut.y)
Expand Down Expand Up @@ -324,7 +325,7 @@ open class RadarChartRenderer(
drawHighlightLines(canvas, pOut.x, pOut.y, set)

if (set.isDrawHighlightCircleEnabled) {
if (!java.lang.Float.isNaN(pOut.x) && !java.lang.Float.isNaN(pOut.y)) {
if (!pOut.x.isNaN() && !pOut.y.isNaN()) {
var strokeColor = set.highlightCircleStrokeColor
if (strokeColor == ColorTemplate.COLOR_NONE) {
strokeColor = set.getColorByIndex(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ open class Transformer(@JvmField protected var viewPortHandler: ViewPortHandler)
var scaleX = viewPortHandler.contentWidth() / deltaX
var scaleY = viewPortHandler.contentHeight() / deltaY

if (java.lang.Float.isInfinite(scaleX)) {
if (scaleX.isInfinite()) {
scaleX = 0f
}
if (java.lang.Float.isInfinite(scaleY)) {
if (scaleY.isInfinite()) {
scaleY = 0f
}

Expand Down
Loading
Loading