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
18 changes: 7 additions & 11 deletions app/src/main/kotlin/info/appdev/chartexample/AnotherBarActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ class AnotherBarActivity : DemoBase(), OnSeekBarChangeListener {
binding.chart1.setMaxVisibleValueCount(60)

// scaling can now only be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
binding.chart1.isPinchZoom = false

binding.chart1.setDrawBarShadow(false)
binding.chart1.isDrawBarShadow = false
binding.chart1.setDrawGridBackground(false)

val xAxis = binding.chart1.xAxis
xAxis.position = XAxisPosition.BOTTOM
xAxis.setDrawGridLines(false)
xAxis.isDrawGridLines = false

binding.chart1.axisLeft.setDrawGridLines(false)
binding.chart1.axisLeft.isDrawGridLines = false

// setting data
binding.seekBarX.progress = DEFAULT_VALUE
Expand Down Expand Up @@ -119,22 +119,18 @@ class AnotherBarActivity : DemoBase(), OnSeekBarChangeListener {

R.id.actionToggleHighlight -> {
binding.chart1.barData?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
it.isHighlight = !it.isHighlight
}
binding.chart1.invalidate()
}

R.id.actionTogglePinch -> {
if (binding.chart1.isPinchZoomEnabled)
binding.chart1.setPinchZoom(false)
else
binding.chart1.setPinchZoom(true)

binding.chart1.isPinchZoom = !binding.chart1.isPinchZoom
binding.chart1.invalidate()
}

R.id.actionToggleAutoScaleMinMax -> {
binding.chart1.isAutoScaleMinMaxEnabled = !binding.chart1.isAutoScaleMinMaxEnabled
binding.chart1.isAutoScaleMinMax = !binding.chart1.isAutoScaleMinMax
binding.chart1.notifyDataSetChanged()
}

Expand Down
18 changes: 8 additions & 10 deletions app/src/main/kotlin/info/appdev/chartexample/BarChartActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
binding.chart1.setOnChartValueSelectedListener(this)
binding.chart1.setRoundedBarRadius(50f)

binding.chart1.setDrawBarShadow(false)
binding.chart1.setDrawValueAboveBar(true)
binding.chart1.isDrawBarShadow = false
binding.chart1.isDrawValueAboveBar = true

binding.chart1.description.isEnabled = false

Expand All @@ -60,7 +60,7 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
binding.chart1.setMaxVisibleValueCount(60)

// scaling can now only be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
binding.chart1.isPinchZoom = false

binding.chart1.setDrawGridBackground(false)

Expand All @@ -70,7 +70,7 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
binding.chart1.xAxis.apply {
position = XAxisPosition.BOTTOM
typeface = tfLight
setDrawGridLines(false)
isDrawGridLines = false
granularity = 1f // only intervals of 1 day
labelCount = 7
valueFormatter = xAxisFormatter
Expand All @@ -88,7 +88,7 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
}

binding.chart1.axisRight.apply {
setDrawGridLines(false)
isDrawGridLines = false
typeface = tfLight
setLabelCount(8, false)
valueFormatter = custom
Expand Down Expand Up @@ -211,20 +211,18 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect

R.id.actionToggleHighlight -> {
binding.chart1.barData?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
it.isHighlight = !it.isHighlight
}
binding.chart1.invalidate()
}

R.id.actionTogglePinch -> {
if (binding.chart1.isPinchZoomEnabled) binding.chart1.setPinchZoom(false)
else binding.chart1.setPinchZoom(true)

binding.chart1.isPinchZoom = !binding.chart1.isPinchZoom
binding.chart1.invalidate()
}

R.id.actionToggleAutoScaleMinMax -> {
binding.chart1.isAutoScaleMinMaxEnabled = !binding.chart1.isAutoScaleMinMaxEnabled
binding.chart1.isAutoScaleMinMax = !binding.chart1.isAutoScaleMinMax
binding.chart1.notifyDataSetChanged()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChar
// chart.setDrawBorders(true);

// scaling can now only be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
binding.chart1.isPinchZoom = false

binding.chart1.setDrawBarShadow(false)
binding.chart1.isDrawBarShadow = false

binding.chart1.setDrawGridBackground(false)

Expand Down Expand Up @@ -90,7 +90,7 @@ class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChar
val leftAxis = binding.chart1.axisLeft
leftAxis.typeface = tfLight
leftAxis.valueFormatter = LargeValueFormatter()
leftAxis.setDrawGridLines(false)
leftAxis.isDrawGridLines = false
leftAxis.spaceTop = 35f
leftAxis.axisMinimum = 0f // this replaces setStartAtZero(true)

Expand Down Expand Up @@ -193,14 +193,12 @@ class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChar
}

R.id.actionTogglePinch -> {
if (binding.chart1.isPinchZoomEnabled) binding.chart1.setPinchZoom(false)
else binding.chart1.setPinchZoom(true)

binding.chart1.isPinchZoom = !binding.chart1.isPinchZoom
binding.chart1.invalidate()
}

R.id.actionToggleAutoScaleMinMax -> {
binding.chart1.isAutoScaleMinMaxEnabled = !binding.chart1.isAutoScaleMinMaxEnabled
binding.chart1.isAutoScaleMinMax = !binding.chart1.isAutoScaleMinMax
binding.chart1.notifyDataSetChanged()
}

Expand All @@ -213,7 +211,7 @@ class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChar

R.id.actionToggleHighlight -> {
binding.chart1.barData?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
it.isHighlight = !it.isHighlight
}
binding.chart1.invalidate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ class BarChartActivitySinus : DemoBase(), OnSeekBarChangeListener {
setContentView(binding.root)

dataSinus = assets.loadBarEntriesFromAssets("sinus_values.txt")
binding.chart1.setDrawBarShadow(false)
binding.chart1.setDrawValueAboveBar(true)
binding.chart1.isDrawBarShadow = false
binding.chart1.isDrawValueAboveBar = true

binding.chart1.description.isEnabled = false

// if more than 60 entries are displayed in the chart, no values will be drawn
binding.chart1.setMaxVisibleValueCount(60)

// scaling can now only be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
binding.chart1.isPinchZoom = false

// draw shadows for each bar that show the maximum value
// chart.setDrawBarShadow(true);
Expand All @@ -58,11 +58,11 @@ class BarChartActivitySinus : DemoBase(), OnSeekBarChangeListener {
leftAxis.setLabelCount(6, false)
leftAxis.axisMinimum = -2.5f
leftAxis.axisMaximum = 2.5f
leftAxis.isGranularityEnabled = true
leftAxis.isGranularity = true
leftAxis.granularity = 0.1f

val rightAxis = binding.chart1.axisRight
rightAxis.setDrawGridLines(false)
rightAxis.isDrawGridLines = false
rightAxis.typeface = tfLight
rightAxis.setLabelCount(6, false)
rightAxis.axisMinimum = -2.5f
Expand Down Expand Up @@ -138,21 +138,18 @@ class BarChartActivitySinus : DemoBase(), OnSeekBarChangeListener {

R.id.actionToggleHighlight -> {
binding.chart1.barData?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
it.isHighlight = !it.isHighlight
}
binding.chart1.invalidate()
}

R.id.actionTogglePinch -> {
if (binding.chart1.isPinchZoomEnabled)
binding.chart1.setPinchZoom(false)
else binding.chart1.setPinchZoom(true)

binding.chart1.isPinchZoom = !binding.chart1.isPinchZoom
binding.chart1.invalidate()
}

R.id.actionToggleAutoScaleMinMax -> {
binding.chart1.isAutoScaleMinMaxEnabled = !binding.chart1.isAutoScaleMinMaxEnabled
binding.chart1.isAutoScaleMinMax = !binding.chart1.isAutoScaleMinMax
binding.chart1.notifyDataSetChanged()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ class BarChartPositiveNegative : DemoBase() {
binding.chart1.extraLeftOffset = 70f
binding.chart1.extraRightOffset = 70f

binding.chart1.setDrawBarShadow(false)
binding.chart1.setDrawValueAboveBar(true)
binding.chart1.isDrawBarShadow = false
binding.chart1.isDrawValueAboveBar = true

binding.chart1.description.isEnabled = false

// scaling can now only be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
binding.chart1.isPinchZoom = false

binding.chart1.setDrawGridBackground(false)

val xAxis = binding.chart1.xAxis
xAxis.position = XAxisPosition.BOTTOM
xAxis.typeface = tfRegular
xAxis.setDrawGridLines(false)
xAxis.setDrawAxisLine(false)
xAxis.isDrawGridLines = false
xAxis.isDrawAxisLine = false
xAxis.textColor = Color.LTGRAY
xAxis.textSize = 13f
xAxis.labelCount = 5
Expand All @@ -61,9 +61,9 @@ class BarChartPositiveNegative : DemoBase() {
left.setDrawLabels(false)
left.spaceTop = 25f
left.spaceBottom = 25f
left.setDrawAxisLine(false)
left.setDrawGridLines(false)
left.setDrawZeroLine(true) // draw a zero line
left.isDrawAxisLine = false
left.isDrawGridLines = false
left.isDrawZeroLine = true // draw a zero line
left.zeroLineColor = Color.GRAY
left.zeroLineWidth = 0.7f
binding.chart1.axisRight.isEnabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSel
binding.chart1.setScaleEnabled(true)

binding.chart1.setMaxVisibleValueCount(200)
binding.chart1.setPinchZoom(true)
binding.chart1.isPinchZoom = true

binding.seekBarX.progress = 10
binding.seekBarY.progress = 50
Expand All @@ -66,7 +66,7 @@ class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSel
yl.typeface = tfLight
yl.spaceTop = 30f
yl.spaceBottom = 30f
yl.setDrawZeroLine(false)
yl.isDrawZeroLine = false

binding.chart1.axisRight.isEnabled = false

Expand Down Expand Up @@ -169,20 +169,18 @@ class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSel

R.id.actionToggleHighlight -> {
binding.chart1.bubbleData?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
it.isHighlight = !it.isHighlight
}
binding.chart1.invalidate()
}

R.id.actionTogglePinch -> {
if (binding.chart1.isPinchZoomEnabled) binding.chart1.setPinchZoom(false)
else binding.chart1.setPinchZoom(true)

binding.chart1.isPinchZoom = !binding.chart1.isPinchZoom
binding.chart1.invalidate()
}

R.id.actionToggleAutoScaleMinMax -> {
binding.chart1.isAutoScaleMinMaxEnabled = !binding.chart1.isAutoScaleMinMaxEnabled
binding.chart1.isAutoScaleMinMax = !binding.chart1.isAutoScaleMinMax
binding.chart1.notifyDataSetChanged()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ class CandleStickChartActivity : DemoBase(), OnSeekBarChangeListener {
binding.chart1.setMaxVisibleValueCount(60)

// scaling can now only be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
binding.chart1.isPinchZoom = false

binding.chart1.setDrawGridBackground(false)

val xAxis = binding.chart1.xAxis
xAxis.position = XAxisPosition.BOTTOM
xAxis.setDrawGridLines(false)
xAxis.isDrawGridLines = false

val leftAxis = binding.chart1.axisLeft
// leftAxis.setEnabled(false);
leftAxis.setLabelCount(7, false)
leftAxis.setDrawGridLines(false)
leftAxis.setDrawAxisLine(false)
leftAxis.isDrawGridLines = false
leftAxis.isDrawAxisLine = false

val rightAxis = binding.chart1.axisRight
rightAxis.isEnabled = false
Expand Down Expand Up @@ -150,20 +150,18 @@ class CandleStickChartActivity : DemoBase(), OnSeekBarChangeListener {

R.id.actionToggleHighlight -> {
binding.chart1.candleData?.let {
it.isHighlightEnabled = !it.isHighlightEnabled
it.isHighlight = !it.isHighlight
}
binding.chart1.invalidate()
}

R.id.actionTogglePinch -> {
if (binding.chart1.isPinchZoomEnabled) binding.chart1.setPinchZoom(false)
else binding.chart1.setPinchZoom(true)

binding.chart1.isPinchZoom = !binding.chart1.isPinchZoom
binding.chart1.invalidate()
}

R.id.actionToggleAutoScaleMinMax -> {
binding.chart1.isAutoScaleMinMaxEnabled = !binding.chart1.isAutoScaleMinMaxEnabled
binding.chart1.isAutoScaleMinMax = !binding.chart1.isAutoScaleMinMax
binding.chart1.notifyDataSetChanged()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class CombinedChartActivity : DemoBase() {
binding.chart1.description.isEnabled = false
binding.chart1.setBackgroundColor(Color.WHITE)
binding.chart1.setDrawGridBackground(false)
binding.chart1.setDrawBarShadow(false)
binding.chart1.isHighlightFullBarEnabled = false
binding.chart1.isDrawBarShadow = false
binding.chart1.isHighlightFullBar = false

// draw bars behind lines
binding.chart1.drawOrder = mutableListOf(
Expand All @@ -64,11 +64,11 @@ class CombinedChartActivity : DemoBase() {
}

val rightAxis = binding.chart1.axisRight
rightAxis.setDrawGridLines(false)
rightAxis.isDrawGridLines = false
rightAxis.axisMinimum = 0f // this replaces setStartAtZero(true)

val leftAxis = binding.chart1.axisLeft
leftAxis.setDrawGridLines(false)
leftAxis.isDrawGridLines = false
leftAxis.axisMinimum = 0f // this replaces setStartAtZero(true)

val xAxis = binding.chart1.xAxis
Expand Down
Loading
Loading