Skip to content
Merged
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,10 +112,10 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener,
val set1: BarDataSet

if (binding.chart1.data != null &&
binding.chart1.data!!.getDataSetCount() > 0
binding.chart1.data!!.dataSetCount > 0
) {
set1 = binding.chart1.data!!.getDataSetByIndex(0) as BarDataSet
set1.entries = values
set1.entries = values
binding.chart1.data!!.notifyDataChanged()
binding.chart1.notifyDataSetChanged()
} else {
Expand Down Expand Up @@ -149,25 +149,24 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener,
}

R.id.actionToggleValues -> {
binding.chart1.data!!.dataSets.forEach {
it?.isDrawValues = !it.isDrawValues
binding.chart1.data?.dataSets?.forEach {
it.isDrawValues = !it.isDrawValues
}
binding.chart1.invalidate()
}

R.id.actionToggleIcons -> {
binding.chart1.data!!.dataSets.forEach { iSet ->
iSet.isDrawIcons = !iSet.isDrawIcons
binding.chart1.data?.dataSets?.forEach { set ->
set.isDrawIcons = !set.isDrawIcons
}

binding.chart1.invalidate()
}

R.id.actionToggleHighlight -> {
if (binding.chart1.data != null) {
binding.chart1.data!!.isHighlightEnabled = !binding.chart1.data!!.isHighlightEnabled()
binding.chart1.invalidate()
binding.chart1.data?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
}
binding.chart1.invalidate()
}

R.id.actionTogglePinch -> {
Expand All @@ -182,8 +181,9 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener,
}

R.id.actionToggleBarBorders -> {
for (set in binding.chart1.data!!.dataSets) (set as BarDataSet).barBorderWidth = if (set.barBorderWidth == 1f) 0f else 1f

binding.chart1.data?.dataSets?.forEach { set ->
(set as BarDataSet).barBorderWidth = if (set.barBorderWidth == 1f) 0f else 1f
}
binding.chart1.invalidate()
}

Expand Down Expand Up @@ -234,8 +234,7 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener,
binding.chart1.getBarBounds(entry as BarEntry, bounds)

val position = binding.chart1.getPosition(
entry, binding.chart1.data!!.getDataSetByIndex(highlight.dataSetIndex)
.axisDependency
entry, binding.chart1.data!!.getDataSetByIndex(highlight.dataSetIndex)?.axisDependency
)

Timber.i("bounds $bounds")
Expand Down
Loading