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
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ android {
testOptions {
animationsDisabled = true
}
lint {
lintConfig = file("lint.xml")
}
packaging {
jniLibs {
// androidx.graphics:graphics-path ships a .so that llvm-strip cannot process;
Expand All @@ -56,6 +59,8 @@ android {
}

dependencies {
lintChecks(project(":lint"))

implementation("androidx.appcompat:appcompat:1.7.1")
implementation("com.google.android.material:material:1.13.0")
implementation(project(":chartLib"))
Expand Down
11 changes: 11 additions & 0 deletions app/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Lint suppressions for the sample/demo app module.
These issues are intentionally suppressed here because this module
demonstrates legacy API usage. The rules still apply to library consumers.
-->
<lint>
<!-- Demo app intentionally uses LineDataSet without explicit type args for brevity. -->
<issue id="RawTypeDataSet" severity="ignore" />
</lint>

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import info.appdev.charting.components.Legend
import info.appdev.charting.components.XAxis
import info.appdev.charting.data.BubbleData
import info.appdev.charting.data.BubbleDataSet
import info.appdev.charting.data.BubbleEntry
import info.appdev.charting.data.BubbleEntryFloat
import info.appdev.charting.data.EntryFloat
import info.appdev.charting.highlight.Highlight
Expand Down
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:9.1.0")
// Lint API version tracks AGP: AGP 9.1.1 → Lint 32.1.1
// in module lint:
// val lintVersion = "32.1.1"
classpath("com.android.tools.build:gradle:9.1.1")
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.20")
}
Expand Down
3 changes: 3 additions & 0 deletions chartLib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ android {
}

dependencies {
lintChecks(project(":lint")) // applies locally
lintPublish(project(path = ":lint", configuration = "lintJar")) // embeds in published AAR

implementation("androidx.annotation:annotation:1.10.0")
implementation("androidx.core:core:1.18.0")
implementation("androidx.activity:activity-ktx:1.13.0")
Expand Down
45 changes: 45 additions & 0 deletions chartLib/src/main/kotlin/info/appdev/charting/data/BarEntry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package info.appdev.charting.data

import android.graphics.drawable.Drawable


@Deprecated(
message = "The replacement is BarEntryFloat, or use BarEntryDouble for higher precision. BarEntry is retained for backward compatibility but will be removed in a future version.",
replaceWith = ReplaceWith("BarEntryFloat", "info.appdev.charting.data.BarEntryFloat")
)
open class BarEntry : BarEntryFloat {

/**
* Constructor for normal bars (not stacked).
*/
constructor(x: Float, y: Float) : super(x, y)

/**
* Constructor for normal bars (not stacked).
*
* @param x
* @param y
* @param data - Spot for additional data this Entry represents.
*/
constructor(x: Float, y: Float, data: Any?) : super(x, y, data)

/**
* Constructor for normal bars (not stacked).
*
* @param x
* @param y
* @param icon - icon image
*/
constructor(x: Float, y: Float, icon: Drawable?) : super(x, y, icon)

/**
* Constructor for normal bars (not stacked).
*
* @param x
* @param y
* @param icon - icon image
* @param data - Spot for additional data this Entry represents.
*/
constructor(x: Float, y: Float, icon: Drawable?, data: Any?) : super(x, y, icon, data)

}
46 changes: 46 additions & 0 deletions chartLib/src/main/kotlin/info/appdev/charting/data/BubbleEntry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package info.appdev.charting.data

import android.annotation.SuppressLint
import android.graphics.drawable.Drawable

@Deprecated(
message = "The replacement is BubbleEntryFloat, or use BubbleEntryDouble for higher precision. BubbleEntry is retained for backward compatibility but will be removed in a future version.",
replaceWith = ReplaceWith("BubbleEntryFloat", "info.appdev.charting.data.BubbleEntryFloat")
)
class BubbleEntry : BubbleEntryFloat {

/**
* Constructor.
*
* @param x The value on the x-axis.
* @param y The value on the y-axis.
* @param size The size of the bubble.
*/
constructor(x: Float, y: Float, size: Float) : super(x, y, size) {
this.size = size
}

/**
* Constructor.
*
* @param x The value on the x-axis.
* @param y The value on the y-axis.
* @param size The size of the bubble.
* @param data Spot for additional data this Entry represents.
*/
constructor(x: Float, y: Float, size: Float, data: Any?) : super(x, y, size, data) {
this.size = size
}

/**
* Constructor.
*
* @param x The value on the x-axis.
* @param y The value on the y-axis.
* @param size The size of the bubble.
* @param icon Icon image
*/
constructor(x: Float, y: Float, size: Float, icon: Drawable?) : super(x, y, size, icon) {
this.size = size
}
}
82 changes: 82 additions & 0 deletions chartLib/src/main/kotlin/info/appdev/charting/data/CandleEntry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package info.appdev.charting.data

import android.graphics.drawable.Drawable

@Deprecated(
message = "The replacement is CandleEntryFloat, or use CandleEntryDouble for higher precision. CandleEntry is retained for backward compatibility but will be removed in a future version.",
replaceWith = ReplaceWith("CandleEntryFloat", "info.appdev.charting.data.CandleEntryFloat")
)
class CandleEntry : CandleEntryFloat {

/**
* Constructor.
*
* @param x The value on the x-axis
* @param shadowH The (shadow) high value
* @param shadowL The (shadow) low value
* @param open The open value
* @param close The close value
*/
constructor(x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float) : super(x, shadowH, shadowL, open, close) {
this.high = shadowH
this.low = shadowL
this.open = open
this.close = close
}

/**
* Constructor.
*
* @param x The value on the x-axis
* @param shadowH The (shadow) high value
* @param shadowL The (shadow) low value
* @param data Spot for additional data this Entry represents
*/
constructor(
x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float,
data: Any?
) : super(x, shadowH, shadowL, open, close) {
this.high = shadowH
this.low = shadowL
this.open = open
this.close = close
}

/**
* Constructor.
*
* @param x The value on the x-axis
* @param shadowH The (shadow) high value
* @param shadowL The (shadow) low value
* @param icon Icon image
*/
constructor(
x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float,
icon: Drawable?
) : super(x, shadowH, shadowL, open, close) {
this.high = shadowH
this.low = shadowL
this.open = open
this.close = close
}

/**
* Constructor.
*
* @param x The value on the x-axis
* @param shadowH The (shadow) high value
* @param shadowL The (shadow) low value
* @param icon Icon image
* @param data Spot for additional data this Entry represents
*/
constructor(
x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float,
icon: Drawable?, data: Any?
) : super(x, shadowH, shadowL, open, close) {
this.high = shadowH
this.low = shadowL
this.open = open
this.close = close
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package info.appdev.charting.data

import android.annotation.SuppressLint
import android.graphics.Typeface
import info.appdev.charting.components.YAxis.AxisDependency
import info.appdev.charting.formatter.IValueFormatter
Expand Down Expand Up @@ -440,6 +441,7 @@ abstract class ChartData<T : IDataSet<out EntryFloat>> : Serializable {
* specified index. Returns true if an Entry was removed, false if no Entry
* was found that meets the specified requirements.
*/
@SuppressLint("RawTypeDataSet")
open fun removeEntry(xValue: Float, dataSetIndex: Int): Boolean {
if (dataSetIndex >= dataSets.size) {
return false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package info.appdev.charting.data

import android.annotation.SuppressLint
import timber.log.Timber
import java.io.Serializable
import kotlin.math.abs
Expand Down Expand Up @@ -130,7 +131,7 @@ abstract class DataSet<T : BaseEntry<Float>>(
*/
abstract fun copy(): DataSet<T>?

protected fun copy(dataSet: DataSet<*>) {
protected fun copy(@SuppressLint("RawTypeDataSet") dataSet: DataSet<*>) {
super.copy(dataSet)
}

Expand Down
63 changes: 63 additions & 0 deletions chartLib/src/main/kotlin/info/appdev/charting/data/Entry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package info.appdev.charting.data

import android.R.attr.data
import android.R.attr.x
import android.R.attr.y
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Parcel
import android.os.ParcelFormatException
import android.os.Parcelable
import info.appdev.charting.utils.Utils
import java.io.Serializable
import kotlin.math.abs

/**
* Class representing one entry in the chart. Might contain multiple values.
* Might only contain a single value depending on the used constructor.
*/
@Deprecated(
message = "The replacement is EntryFloat, or use EntryDouble for higher precision. Entry is retained for backward compatibility but will be removed in a future version.",
replaceWith = ReplaceWith("EntryFloat", "info.appdev.charting.data.EntryFloat")
)
class Entry : EntryFloat {

constructor()

/**
* An EntryFloat represents one single entry in the chart.
*
* @param x the x value
* @param y the y value (the actual value of the entry)
*/
constructor(x: Float, y: Float) : super(x = x, y = y)

/**
* An EntryFloat represents one single entry in the chart.
*
* @param x the x value
* @param y the y value (the actual value of the entry)
* @param data Spot for additional data this Entry represents.
*/
constructor(x: Float, y: Float, data: Any?) : super(x = x, y = y, data = data)

/**
* An EntryFloat represents one single entry in the chart.
*
* @param x the x value
* @param y the y value (the actual value of the entry)
* @param icon icon image
*/
constructor(x: Float, y: Float, icon: Drawable?) : super(x = x, y = y, icon = icon)

/**
* An EntryFloat represents one single entry in the chart.
*
* @param x the x value
* @param y the y value (the actual value of the entry)
* @param icon icon image
* @param data Spot for additional data this EntryFloat represents.
*/
constructor(x: Float, y: Float, icon: Drawable?, data: Any?) : super(x = x, y = y, icon = icon, data = data)

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package info.appdev.charting.data

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.graphics.DashPathEffect
Expand Down Expand Up @@ -84,7 +85,7 @@ open class LineDataSet<T : BaseEntry<Float>>(yVals: MutableList<T> = mutableList
return copied as DataSet<T>
}

protected fun copy(lineDataSet: LineDataSet<*>) {
protected fun copy(@SuppressLint("RawTypeDataSet") lineDataSet: LineDataSet<*>) {
super.copy((lineDataSet as BaseDataSet<*>?)!!)
lineDataSet.circleColors = this.circleColors
lineDataSet.mCircleHoleColor = mCircleHoleColor
Expand Down
35 changes: 35 additions & 0 deletions chartLib/src/main/kotlin/info/appdev/charting/data/PieEntry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package info.appdev.charting.data

import android.graphics.drawable.Drawable

@Deprecated(
message = "The replacement is PieEntryFloat, or use PieEntryDouble for higher precision. PieEntry is retained for backward compatibility but will be removed in a future version.",
replaceWith = ReplaceWith("PieEntryFloat", "info.appdev.charting.data.PieEntryFloat")
)
class PieEntry : PieEntryFloat {

constructor(value: Float) : super(0f)

constructor(value: Float, data: Any?) : super(value, data)

constructor(value: Float, icon: Drawable?) : super(value, icon)

constructor(value: Float, icon: Drawable?, data: Any?) : super(value, icon, data)

constructor(value: Float, label: String?) : super(value) {
this.label = label
}

constructor(value: Float, label: String?, data: Any?) : super(value, data) {
this.label = label
}

constructor(value: Float, label: String?, icon: Drawable?) : super(value, icon) {
this.label = label
}

constructor(value: Float, label: String?, icon: Drawable?, data: Any?) : super(value, icon, data) {
this.label = label
}

}
Loading
Loading