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
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class CombinedChartActivity : DemoBase() {
set.lineMode = LineDataSet.Mode.CUBIC_BEZIER
set.isDrawValues = true
set.valueTextSize = 10f
set.setSingleValueTextColor(Color.rgb(240, 238, 70))
set.valueTextColor = Color.rgb(240, 238, 70)

set.axisDependency = YAxis.AxisDependency.LEFT
d.addDataSet(set)
Expand All @@ -133,14 +133,14 @@ class CombinedChartActivity : DemoBase() {

val set1 = BarDataSet(entries1, "Bar 1")
set1.color = Color.rgb(60, 220, 78)
set1.setSingleValueTextColor(Color.rgb(60, 220, 78))
set1.valueTextColor = Color.rgb(60, 220, 78)
set1.valueTextSize = 10f
set1.axisDependency = YAxis.AxisDependency.LEFT

val set2 = BarDataSet(entries2, "")
set2.stackLabels = mutableListOf("Stack 1", "Stack 2")
set2.setColors(Color.rgb(61, 165, 255), Color.rgb(23, 197, 255))
set2.setSingleValueTextColor(Color.rgb(61, 165, 255))
set2.valueTextColor = Color.rgb(61, 165, 255)
set2.valueTextSize = 10f
set2.axisDependency = YAxis.AxisDependency.LEFT

Expand Down Expand Up @@ -215,7 +215,7 @@ class CombinedChartActivity : DemoBase() {
val set = BubbleDataSet(entries, "Bubble DataSet")
set.setColors(*ColorTemplate.VORDIPLOM_COLORS)
set.valueTextSize = 10f
set.setSingleValueTextColor(Color.WHITE)
set.valueTextColor = Color.WHITE
set.highlightCircleWidth = 1.5f
set.isDrawValues = true
bd.addDataSet(set)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class DynamicalAddingActivity : DemoBase(), OnChartValueSelectedListener {
set.setCircleColor(color)
set.highLightColor = color
set.valueTextSize = 10f
set.setSingleValueTextColor(color)
set.valueTextColor = color

data.addDataSet(set)
data.notifyDataChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener {
val set1 = LineDataSet(values, "DataSet 1")
set1.axisDependency = AxisDependency.LEFT
set1.color = holoBlue
set1.setSingleValueTextColor(holoBlue)
set1.valueTextColor = holoBlue
set1.lineWidth = 1.5f
set1.isDrawCirclesEnabled = false
set1.isDrawValues = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class RealtimeLineChartActivity : DemoBase(), OnChartValueSelectedListener {
set.fillAlpha = 65
set.fillColor = ColorTemplate.holoBlue
set.highLightColor = Color.rgb(244, 117, 117)
set.setSingleValueTextColor(Color.WHITE)
set.valueTextColor = Color.WHITE
set.valueTextSize = 9f
set.isDrawValues = false
return set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ abstract class SimpleFragment : Fragment() {
val ds1 = PieDataSet(entries1, "Quarterly Revenues 2015")
ds1.setColors(*ColorTemplate.VORDIPLOM_COLORS)
ds1.sliceSpace = 2f
ds1.setSingleValueTextColor(Color.WHITE)
ds1.valueTextColor = Color.WHITE
ds1.valueTextSize = 12f

val d = PieData(ds1)
Expand Down
19 changes: 12 additions & 7 deletions chartLib/src/main/kotlin/info/appdev/charting/data/BaseDataSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,24 @@ abstract class BaseDataSet<T : Entry>() : IDataSet<T> {
return mValueFormatter == null
}

override fun setSingleValueTextColor(value: Int) {
mValueColors.clear()
mValueColors.add(value)
}

override var valueTextColors: MutableList<Int>
get() = mValueColors
set(value) {
mValueColors = value
}

override fun getValueTextColor(index: Int): Int {
return mValueColors[index % mValueColors.size]
override var valueTextColor: Int
get() = if (mValueColors.isEmpty())
0
else
mValueColors[0]
set(value) {
mValueColors.clear()
mValueColors.add(value)
}

override fun getValueTextColor(value: Int): Int {
return mValueColors[value % mValueColors.size]
}

override var valueTypeface: Typeface?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ abstract class ChartData<T : IDataSet<out Entry>> : Serializable {
*/
fun setValueTextColor(color: Int) {
for (set in this.dataSets!!) {
set.setSingleValueTextColor(color)
set.valueTextColor = color
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,12 @@ interface IDataSet<T : Entry> {
*/
fun needsFormatter(): Boolean

fun setSingleValueTextColor(value: Int)
/**
* Sets the color the value-labels of this DataSet should have.
*/
fun getValueTextColor(index: Int): Int
var valueTextColor: Int
// This getter is necessary because of the parameter value
fun getValueTextColor(value: Int): Int

var valueTextColors: MutableList<Int>

Expand Down
Loading