diff --git a/app/src/main/kotlin/info/appdev/chartexample/AnotherBarActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/AnotherBarActivity.kt index 36df451ac..f0cb98037 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/AnotherBarActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/AnotherBarActivity.kt @@ -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 @@ -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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivity.kt index 32e6b56ab..219b3ea83 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivity.kt @@ -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 @@ -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) @@ -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 @@ -88,7 +88,7 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect } binding.chart1.axisRight.apply { - setDrawGridLines(false) + isDrawGridLines = false typeface = tfLight setLabelCount(8, false) valueFormatter = custom @@ -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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivityMultiDataset.kt b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivityMultiDataset.kt index d73b67f29..efad124f7 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivityMultiDataset.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivityMultiDataset.kt @@ -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) @@ -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) @@ -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() } @@ -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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt index 4dd068cc6..6cfc22dcd 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt @@ -32,8 +32,8 @@ 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 @@ -41,7 +41,7 @@ class BarChartActivitySinus : 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 // draw shadows for each bar that show the maximum value // chart.setDrawBarShadow(true); @@ -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 @@ -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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/BarChartPositiveNegative.kt b/app/src/main/kotlin/info/appdev/chartexample/BarChartPositiveNegative.kt index 9d706931b..04e6e370d 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/BarChartPositiveNegative.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/BarChartPositiveNegative.kt @@ -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 @@ -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 diff --git a/app/src/main/kotlin/info/appdev/chartexample/BubbleChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/BubbleChartActivity.kt index 7fdfe9c51..a478a0f64 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/BubbleChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/BubbleChartActivity.kt @@ -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 @@ -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 @@ -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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/CandleStickChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/CandleStickChartActivity.kt index ad5711a63..810613f2f 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/CandleStickChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/CandleStickChartActivity.kt @@ -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 @@ -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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt index bde1f6dea..f2d7cc2fe 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt @@ -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( @@ -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 diff --git a/app/src/main/kotlin/info/appdev/chartexample/CubicLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/CubicLineChartActivity.kt index 4506fb8a6..7e478b5ea 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/CubicLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/CubicLineChartActivity.kt @@ -46,7 +46,7 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { binding.chart1.setScaleEnabled(true) // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(false) + binding.chart1.isPinchZoom = false binding.chart1.setDrawGridBackground(false) binding.chart1.maxHighlightDistance = 300f @@ -59,7 +59,7 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { y.setLabelCount(6, false) y.textColor = Color.WHITE y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART) - y.setDrawGridLines(false) + y.isDrawGridLines = false y.axisLineColor = Color.WHITE binding.chart1.axisRight.isEnabled = false @@ -104,7 +104,7 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { set1.lineMode = LineDataSet.Mode.CUBIC_BEZIER set1.cubicIntensity = 0.2f - set1.isDrawFilledEnabled = true + set1.isDrawFilled = true set1.isDrawCircles = false set1.lineWidth = 1.8f set1.circleRadius = 4f @@ -113,7 +113,7 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { set1.color = Color.WHITE set1.fillColor = Color.WHITE set1.fillAlpha = 100 - set1.setDrawHorizontalHighlightIndicator(false) + set1.isHorizontalHighlightIndicator = false set1.fillFormatter = object : IFillFormatter { override fun getFillLinePosition(dataSet: ILineDataSet?, dataProvider: LineDataProvider): Float { return binding.chart1.axisLeft.axisMinimum @@ -153,7 +153,7 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { R.id.actionToggleHighlight -> { binding.chart1.lineData.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } @@ -161,7 +161,7 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { R.id.actionToggleFilled -> { binding.chart1.lineData.dataSets.forEach { val set = it as LineDataSet - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } @@ -208,15 +208,12 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener { } 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/DataTools.kt b/app/src/main/kotlin/info/appdev/chartexample/DataTools.kt index f1fb7f0c7..84c7deb04 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/DataTools.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/DataTools.kt @@ -220,7 +220,7 @@ class DataTools { lineDataSet01.enableDashedHighlightLine(10f, 5f, 0f) // set the filled area - lineDataSet01.isDrawFilledEnabled = true + lineDataSet01.isDrawFilled = true lineDataSet01.fillFormatter = object : IFillFormatter { override fun getFillLinePosition(dataSet: ILineDataSet?, dataProvider: LineDataProvider): Float { return lineChart.axisLeft.axisMinimum diff --git a/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt index f3856eb8a..9194ee49c 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/DrawChartActivity.kt @@ -44,7 +44,7 @@ class DrawChartActivity : DemoBase(), OnChartValueSelectedListener, OnDrawListen val xl = binding.chart1.xAxis xl.typeface = tfRegular - xl.setAvoidFirstLastClipping(true) + xl.isAvoidFirstLastClipping = true val yl = binding.chart1.axisLeft yl.typeface = tfRegular @@ -86,20 +86,18 @@ class DrawChartActivity : DemoBase(), OnChartValueSelectedListener, OnDrawListen R.id.actionToggleHighlight -> { binding.chart1.data?.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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/DynamicalAddingActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/DynamicalAddingActivity.kt index 8f1c7d9e7..aa371611f 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/DynamicalAddingActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/DynamicalAddingActivity.kt @@ -37,7 +37,7 @@ class DynamicalAddingActivity : DemoBase(), OnChartValueSelectedListener { binding.chart1.setNoDataText("No chart data available. Use the menu to add entries and data sets!") // chart.getXAxis().setDrawLabels(false); -// chart.getXAxis().setDrawGridLines(false); +// chart.getXAxis().isDrawGridLines = false; binding.chart1.invalidate() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/FilledLineActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/FilledLineActivity.kt index 968e3f23a..528f1b2e7 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/FilledLineActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/FilledLineActivity.kt @@ -44,7 +44,7 @@ class FilledLineActivity : DemoBase() { binding.chart1.description.isEnabled = false // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(false) + binding.chart1.isPinchZoom = false binding.chart1.legend.apply { isEnabled = false @@ -56,9 +56,9 @@ class FilledLineActivity : DemoBase() { val leftAxis = binding.chart1.axisLeft leftAxis.axisMaximum = 900f leftAxis.axisMinimum = -250f - leftAxis.setDrawAxisLine(false) - leftAxis.setDrawZeroLine(false) - leftAxis.setDrawGridLines(false) + leftAxis.isDrawAxisLine = false + leftAxis.isDrawZeroLine = false + leftAxis.isDrawGridLines = false binding.chart1.axisRight.isEnabled = false @@ -104,7 +104,7 @@ class FilledLineActivity : DemoBase() { set1.lineWidth = 2f set1.circleRadius = 3f set1.fillAlpha = 255 - set1.isDrawFilledEnabled = true + set1.isDrawFilled = true set1.fillColor = Color.WHITE set1.highLightColor = Color.rgb(244, 117, 117) set1.isDrawCircleHoleEnabled = false @@ -124,7 +124,7 @@ class FilledLineActivity : DemoBase() { set2.lineWidth = 2f set2.circleRadius = 3f set2.fillAlpha = 255 - set2.isDrawFilledEnabled = true + set2.isDrawFilled = true set2.fillColor = Color.WHITE set2.isDrawCircleHoleEnabled = false set2.highLightColor = Color.rgb(244, 117, 117) diff --git a/app/src/main/kotlin/info/appdev/chartexample/GradientActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/GradientActivity.kt index 8db1b7565..3929b8dfe 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/GradientActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/GradientActivity.kt @@ -53,7 +53,7 @@ class GradientActivity : DemoBase() { isDrawCircles = false lineWidth = 2f - isDrawFilledEnabled = true + isDrawFilled = true fillAlpha = 255 fillDrawable = ContextCompat.getDrawable( this@GradientActivity, diff --git a/app/src/main/kotlin/info/appdev/chartexample/HalfPieChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/HalfPieChartActivity.kt index 1ec77d159..8046b5491 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/HalfPieChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/HalfPieChartActivity.kt @@ -37,13 +37,13 @@ class HalfPieChartActivity : DemoBase() { moveOffScreen() - binding.chart1.setUsePercentValues(true) + binding.chart1.isUsePercentValues = true binding.chart1.description.isEnabled = false binding.chart1.setCenterTextTypeface(tfLight) binding.chart1.centerText = generateCenterSpannableText() - binding.chart1.isDrawHoleEnabled = true + binding.chart1.isDrawHole = true binding.chart1.setHoleColor(Color.WHITE) binding.chart1.setTransparentCircleColor(Color.WHITE) @@ -52,7 +52,7 @@ class HalfPieChartActivity : DemoBase() { binding.chart1.holeRadius = 58f binding.chart1.transparentCircleRadius = 61f - binding.chart1.setDrawCenterText(true) + binding.chart1.isDrawCenterText = true binding.chart1.isRotationEnabled = false binding.chart1.isHighlightPerTapEnabled = true diff --git a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt index 69a9e97b7..14d01b830 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarChartActivity.kt @@ -43,9 +43,9 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV binding.chart1.isLogEnabled = true // chart.setHighlightEnabled(false); - binding.chart1.setDrawBarShadow(false) + binding.chart1.isDrawBarShadow = false - binding.chart1.setDrawValueAboveBar(true) + binding.chart1.isDrawValueAboveBar = true binding.chart1.description.isEnabled = false @@ -54,7 +54,7 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV 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); @@ -63,21 +63,21 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV val xl = binding.chart1.xAxis xl.position = XAxisPosition.BOTTOM xl.typeface = tfLight - xl.setDrawAxisLine(true) - xl.setDrawGridLines(false) + xl.isDrawAxisLine = true + xl.isDrawGridLines = false xl.granularity = 10f val yl = binding.chart1.axisLeft yl.typeface = tfLight - yl.setDrawAxisLine(true) - yl.setDrawGridLines(true) + yl.isDrawAxisLine = true + yl.isDrawGridLines = true yl.axisMinimum = 0f // this replaces setStartAtZero(true) // yl.setInverted(true); val yr = binding.chart1.axisRight yr.typeface = tfLight - yr.setDrawAxisLine(true) - yr.setDrawGridLines(false) + yr.isDrawAxisLine = true + yr.isDrawGridLines = false yr.axisMinimum = 0f // this replaces setStartAtZero(true) // yr.setInverted(true); @@ -169,19 +169,18 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV R.id.actionToggleHighlight -> { binding.chart1.barData?.let { data -> - data.isHighlightEnabled = !data.isHighlightEnabled + data.isHighlight = !data.isHighlight binding.chart1.invalidate() } } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) - + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt index 1c9c63bb4..fbeac36f8 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/HorizontalBarNegativeChartActivity.kt @@ -42,8 +42,8 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener, binding.chart1.setOnChartValueSelectedListener(this) // chart.setHighlightEnabled(false); - binding.chart1.setDrawBarShadow(false) - binding.chart1.setDrawValueAboveBar(true) + binding.chart1.isDrawBarShadow = false + binding.chart1.isDrawValueAboveBar = true binding.chart1.description.isEnabled = false @@ -52,7 +52,7 @@ class HorizontalBarNegativeChartActivity : 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 // draw shadows for each bar that show the maximum value // chart.setDrawBarShadow(true); @@ -61,20 +61,20 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener, val xl = binding.chart1.xAxis xl.position = XAxisPosition.BOTTOM xl.typeface = tfLight - xl.setDrawAxisLine(true) - xl.setDrawGridLines(false) + xl.isDrawAxisLine = true + xl.isDrawGridLines = false xl.granularity = 10f val yl = binding.chart1.axisLeft yl.typeface = tfLight - yl.setDrawAxisLine(true) - yl.setDrawGridLines(true) + yl.isDrawAxisLine = true + yl.isDrawGridLines = true // yl.setInverted(true); val yr = binding.chart1.axisRight yr.typeface = tfLight - yr.setDrawAxisLine(true) - yr.setDrawGridLines(false) + yr.isDrawAxisLine = true + yr.isDrawGridLines = false // yr.setInverted(true); binding.chart1.setFitBars(true) @@ -165,19 +165,18 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener, R.id.actionToggleHighlight -> { binding.chart1.barData?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) - + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt index a309a418b..f3191f4f5 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/InvertedLineChartActivity.kt @@ -50,7 +50,7 @@ class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa binding.chart1.setScaleEnabled(true) // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(true) + binding.chart1.isPinchZoom = true // set an alternative background color // chart.setBackgroundColor(Color.GRAY); @@ -62,7 +62,7 @@ class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa binding.chart1.setMarker(mv) // Set the marker to the chart val xl = binding.chart1.xAxis - xl.setAvoidFirstLastClipping(true) + xl.isAvoidFirstLastClipping = true xl.axisMinimum = 0f val leftAxis = binding.chart1.axisLeft @@ -140,14 +140,14 @@ class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa R.id.actionToggleHighlight -> { binding.chart1.data?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } @@ -172,13 +172,12 @@ class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) - + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt index 49127bd5a..a828b8b35 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt @@ -67,7 +67,7 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec binding.chart1.setScaleEnabled(true) // force pinch zoom along both axis - binding.chart1.setPinchZoom(true) + binding.chart1.isPinchZoom = true // vertical grid lines binding.chart1.xAxis.enableGridDashedLine(10f, 10f, 0f) @@ -168,14 +168,14 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec R.id.actionToggleHighlight -> { binding.chart1.data?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight binding.chart1.invalidate() } } R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled binding.chart1.invalidate() } } @@ -218,12 +218,12 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/LineChartActivityColored.kt b/app/src/main/kotlin/info/appdev/chartexample/LineChartActivityColored.kt index 35f4567bc..7025a8c38 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/LineChartActivityColored.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/LineChartActivityColored.kt @@ -69,7 +69,7 @@ class LineChartActivityColored : DemoBase() { chart.setScaleEnabled(true) // if disabled, scaling can be done on x- and y-axis separately - chart.setPinchZoom(false) + chart.isPinchZoom = false chart.setBackgroundColor(color) diff --git a/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt index e0208842b..4a56bf880 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/LineChartDualAxisActivity.kt @@ -58,7 +58,7 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa binding.chart1.isHighlightPerDragEnabled = true // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(true) + binding.chart1.isPinchZoom = true // set an alternative background color binding.chart1.setBackgroundColor(Color.LTGRAY) @@ -86,25 +86,25 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa xAxis.typeface = tfLight xAxis.textSize = 11f xAxis.textColor = Color.WHITE - xAxis.setDrawGridLines(false) - xAxis.setDrawAxisLine(false) + xAxis.isDrawGridLines = false + xAxis.isDrawAxisLine = false val leftAxis = binding.chart1.axisLeft leftAxis.typeface = tfLight leftAxis.textColor = ColorTemplate.holoBlue leftAxis.axisMaximum = 200f leftAxis.axisMinimum = 0f - leftAxis.setDrawGridLines(true) - leftAxis.isGranularityEnabled = true + leftAxis.isDrawGridLines = true + leftAxis.isGranularity = true val rightAxis = binding.chart1.axisRight rightAxis.typeface = tfLight rightAxis.textColor = Color.MAGENTA rightAxis.axisMaximum = 900f rightAxis.axisMinimum = -200f - rightAxis.setDrawGridLines(false) - rightAxis.setDrawZeroLine(false) - rightAxis.isGranularityEnabled = false + rightAxis.isDrawGridLines = false + rightAxis.isDrawZeroLine = false + rightAxis.isGranularity = false } private fun setData(count: Int, range: Float) { @@ -219,14 +219,14 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa R.id.actionToggleHighlight -> { binding.chart1.data?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } @@ -269,13 +269,12 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) - + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/LineChartTimeActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/LineChartTimeActivity.kt index 8e1bbf292..fd1a1bb72 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/LineChartTimeActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/LineChartTimeActivity.kt @@ -71,8 +71,8 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener { xAxis.typeface = tfLight xAxis.textSize = 10f xAxis.textColor = Color.WHITE - xAxis.setDrawAxisLine(false) - xAxis.setDrawGridLines(true) + xAxis.isDrawAxisLine = false + xAxis.isDrawGridLines = true xAxis.textColor = Color.rgb(255, 192, 56) xAxis.setCenterAxisLabels(true) xAxis.granularity = 1f // one hour @@ -89,8 +89,8 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener { leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART) leftAxis.typeface = tfLight leftAxis.textColor = holoBlue - leftAxis.setDrawGridLines(true) - leftAxis.isGranularityEnabled = true + leftAxis.isDrawGridLines = true + leftAxis.isGranularity = true leftAxis.axisMinimum = 0f leftAxis.axisMaximum = 170f leftAxis.yOffset = -9f @@ -167,14 +167,14 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener { R.id.actionToggleHighlight -> { binding.chart1.data?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } @@ -207,14 +207,12 @@ class LineChartTimeActivity : DemoBase(), OnSeekBarChangeListener { } 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/ListViewBarChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/ListViewBarChartActivity.kt index 0d7b9f548..9293a6d81 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/ListViewBarChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/ListViewBarChartActivity.kt @@ -75,7 +75,7 @@ class ListViewBarChartActivity : DemoBase() { holder.chart?.xAxis?.apply { this.position = XAxisPosition.BOTTOM typeface = tfLight - setDrawGridLines(false) + isDrawGridLines = false } holder.chart?.axisLeft?.apply { diff --git a/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt index 64d4e0364..38b89d9fd 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/MultiLineChartActivity.kt @@ -43,10 +43,10 @@ class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestu binding.chart1.setDrawBorders(false) binding.chart1.axisLeft.isEnabled = false - binding.chart1.axisRight.setDrawAxisLine(false) - binding.chart1.axisRight.setDrawGridLines(false) - binding.chart1.xAxis.setDrawAxisLine(false) - binding.chart1.xAxis.setDrawGridLines(false) + binding.chart1.axisRight.isDrawAxisLine = false + binding.chart1.axisRight.isDrawGridLines = false + binding.chart1.xAxis.isDrawAxisLine = false + binding.chart1.xAxis.isDrawGridLines = false // enable touch gestures binding.chart1.setTouchEnabled(true) @@ -56,7 +56,7 @@ class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestu binding.chart1.setScaleEnabled(true) // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(false) + binding.chart1.isPinchZoom = false binding.seekBarX.progress = 20 binding.seekBarY.progress = 100 @@ -137,27 +137,25 @@ class MultiLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartGestu } 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() } R.id.actionToggleHighlight -> { binding.chart1.data?.let { data -> - data.isHighlightEnabled = !data.isHighlightEnabled + data.isHighlight = !data.isHighlight } binding.chart1.invalidate() } R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/PerformanceLineChart.kt b/app/src/main/kotlin/info/appdev/chartexample/PerformanceLineChart.kt index 9d436988f..b352fa1a8 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PerformanceLineChart.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PerformanceLineChart.kt @@ -39,12 +39,12 @@ class PerformanceLineChart : DemoBase(), OnSeekBarChangeListener { binding.chart1.setScaleEnabled(true) // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(false) + binding.chart1.isPinchZoom = false - binding.chart1.axisLeft.setDrawGridLines(false) + binding.chart1.axisLeft.isDrawGridLines = false binding.chart1.axisRight.isEnabled = false - binding.chart1.xAxis.setDrawGridLines(true) - binding.chart1.xAxis.setDrawAxisLine(false) + binding.chart1.xAxis.isDrawGridLines = true + binding.chart1.xAxis.isDrawAxisLine = false binding.seekbarValues.progress = 9000 @@ -69,7 +69,7 @@ class PerformanceLineChart : DemoBase(), OnSeekBarChangeListener { set1.isDrawValues = false set1.isDrawCircles = false set1.lineMode = LineDataSet.Mode.LINEAR - set1.isDrawFilledEnabled = false + set1.isDrawFilled = false // create a data object with the data sets val data = LineData(set1) diff --git a/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt index 6ae98d2c8..7ef544c0d 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PieChartActivity.kt @@ -45,7 +45,7 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect binding.seekBarX.setOnSeekBarChangeListener(this) binding.seekBarY.setOnSeekBarChangeListener(this) - binding.chart1.setUsePercentValues(true) + binding.chart1.isUsePercentValues = true binding.chart1.description.isEnabled = false binding.chart1.setExtraOffsets(5f, 10f, 5f, 5f) @@ -54,7 +54,7 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect binding.chart1.setCenterTextTypeface(tfLight) binding.chart1.centerText = generateCenterSpannableText() - binding.chart1.isDrawHoleEnabled = true + binding.chart1.isDrawHole = true binding.chart1.setHoleColor(Color.WHITE) binding.chart1.setTransparentCircleColor(Color.WHITE) @@ -63,7 +63,7 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect binding.chart1.holeRadius = 58f binding.chart1.transparentCircleRadius = 61f - binding.chart1.setDrawCenterText(true) + binding.chart1.isDrawCenterText = true binding.chart1.rotationAngle = 0f // enable rotation of the chart by touch @@ -182,7 +182,7 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect } R.id.actionToggleHole -> { - binding.chart1.isDrawHoleEnabled = !binding.chart1.isDrawHoleEnabled + binding.chart1.isDrawHole = !binding.chart1.isDrawHole binding.chart1.invalidate() } @@ -196,29 +196,29 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect } R.id.actionToggleCurvedSlices -> { - val toSet = !binding.chart1.isDrawRoundedSlicesEnabled || !binding.chart1.isDrawHoleEnabled - binding.chart1.setDrawRoundedSlices(toSet) - if (toSet && !binding.chart1.isDrawHoleEnabled) { - binding.chart1.isDrawHoleEnabled = true + val toSet = !binding.chart1.isDrawRoundedSlices || !binding.chart1.isDrawHole + binding.chart1.isDrawRoundedSlices = toSet + if (toSet && !binding.chart1.isDrawHole) { + binding.chart1.isDrawHole = true } - if (toSet && binding.chart1.isDrawSlicesUnderHoleEnabled) { - binding.chart1.setDrawSlicesUnderHole(false) + if (toSet && binding.chart1.isDrawSlicesUnderHole) { + binding.chart1.isDrawSlicesUnderHole = false } binding.chart1.invalidate() } R.id.actionDrawCenter -> { - binding.chart1.setDrawCenterText(!binding.chart1.isDrawCenterTextEnabled) + binding.chart1.isDrawCenterText = !binding.chart1.isDrawCenterText binding.chart1.invalidate() } R.id.actionToggleXValues -> { - binding.chart1.setDrawEntryLabels(!binding.chart1.isDrawEntryLabelsEnabled) + binding.chart1.isDrawEntryLabels = !binding.chart1.isDrawEntryLabels binding.chart1.invalidate() } R.id.actionTogglePercent -> { - binding.chart1.setUsePercentValues(!binding.chart1.isUsePercentValuesEnabled) + binding.chart1.isUsePercentValues = !binding.chart1.isUsePercentValues binding.chart1.invalidate() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt index 6e8ad6911..8c065edde 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PieChartRoundedActivity.kt @@ -45,7 +45,7 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu binding.seekBarX.setOnSeekBarChangeListener(this) binding.seekBarY.setOnSeekBarChangeListener(this) - binding.chart1.setUsePercentValues(true) + binding.chart1.isUsePercentValues = true binding.chart1.description.isEnabled = false binding.chart1.setExtraOffsets(5f, 10f, 5f, 5f) @@ -54,7 +54,7 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu binding.chart1.setCenterTextTypeface(tfLight) binding.chart1.centerText = generateCenterSpannableText() - binding.chart1.isDrawHoleEnabled = true + binding.chart1.isDrawHole = true binding.chart1.setHoleColor(Color.TRANSPARENT) binding.chart1.setTransparentCircleColor(Color.TRANSPARENT) @@ -64,7 +64,7 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu binding.chart1.transparentCircleRadius = 0f - binding.chart1.setDrawCenterText(true) + binding.chart1.isDrawCenterText = true binding.chart1.rotationAngle = 0f // enable rotation of the chart by touch @@ -186,7 +186,7 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu } R.id.actionToggleHole -> { - binding.chart1.isDrawHoleEnabled = !binding.chart1.isDrawHoleEnabled + binding.chart1.isDrawHole = !binding.chart1.isDrawHole binding.chart1.invalidate() } @@ -200,29 +200,29 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu } R.id.actionToggleCurvedSlices -> { - val toSet = !binding.chart1.isDrawRoundedSlicesEnabled || !binding.chart1.isDrawHoleEnabled - binding.chart1.setDrawRoundedSlices(toSet) - if (toSet && !binding.chart1.isDrawHoleEnabled) { - binding.chart1.isDrawHoleEnabled = true + val toSet = !binding.chart1.isDrawRoundedSlices || !binding.chart1.isDrawHole + binding.chart1.isDrawRoundedSlices = toSet + if (toSet && !binding.chart1.isDrawHole) { + binding.chart1.isDrawHole = true } - if (toSet && binding.chart1.isDrawSlicesUnderHoleEnabled) { - binding.chart1.setDrawSlicesUnderHole(false) + if (toSet && binding.chart1.isDrawSlicesUnderHole) { + binding.chart1.isDrawSlicesUnderHole = false } binding.chart1.invalidate() } R.id.actionDrawCenter -> { - binding.chart1.setDrawCenterText(!binding.chart1.isDrawCenterTextEnabled) + binding.chart1.isDrawCenterText = !binding.chart1.isDrawCenterText binding.chart1.invalidate() } R.id.actionToggleXValues -> { - binding.chart1.setDrawEntryLabels(!binding.chart1.isDrawEntryLabelsEnabled) + binding.chart1.isDrawEntryLabels = !binding.chart1.isDrawEntryLabels binding.chart1.invalidate() } R.id.actionTogglePercent -> { - binding.chart1.setUsePercentValues(!binding.chart1.isUsePercentValuesEnabled) + binding.chart1.isUsePercentValues = !binding.chart1.isUsePercentValues binding.chart1.invalidate() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt index 14b6c6d22..4a422ffac 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/PiePolylineChartActivity.kt @@ -44,7 +44,7 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal binding.seekBarX.setOnSeekBarChangeListener(this) binding.seekBarY.setOnSeekBarChangeListener(this) - binding.chart1.setUsePercentValues(true) + binding.chart1.isUsePercentValues = true binding.chart1.description.isEnabled = false binding.chart1.setExtraOffsets(5f, 10f, 5f, 5f) @@ -57,7 +57,7 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal binding.chart1.setExtraOffsets(20f, 0f, 20f, 0f) - binding.chart1.isDrawHoleEnabled = true + binding.chart1.isDrawHole = true binding.chart1.setHoleColor(Color.WHITE) binding.chart1.setTransparentCircleColor(Color.WHITE) @@ -66,7 +66,7 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal binding.chart1.holeRadius = 58f binding.chart1.transparentCircleRadius = 61f - binding.chart1.setDrawCenterText(true) + binding.chart1.isDrawCenterText = true binding.chart1.rotationAngle = 0f // enable rotation of the chart by touch @@ -168,7 +168,7 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal } R.id.actionToggleHole -> { - binding.chart1.isDrawHoleEnabled = !binding.chart1.isDrawHoleEnabled + binding.chart1.isDrawHole = !binding.chart1.isDrawHole binding.chart1.invalidate() } @@ -182,29 +182,29 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal } R.id.actionToggleCurvedSlices -> { - val toSet = !binding.chart1.isDrawRoundedSlicesEnabled || !binding.chart1.isDrawHoleEnabled - binding.chart1.setDrawRoundedSlices(toSet) - if (toSet && !binding.chart1.isDrawHoleEnabled) { - binding.chart1.isDrawHoleEnabled = true + val toSet = !binding.chart1.isDrawRoundedSlices || !binding.chart1.isDrawHole + binding.chart1.isDrawRoundedSlices = toSet + if (toSet && !binding.chart1.isDrawHole) { + binding.chart1.isDrawHole = true } - if (toSet && binding.chart1.isDrawSlicesUnderHoleEnabled) { - binding.chart1.setDrawSlicesUnderHole(false) + if (toSet && binding.chart1.isDrawSlicesUnderHole) { + binding.chart1.isDrawSlicesUnderHole = false } binding.chart1.invalidate() } R.id.actionDrawCenter -> { - binding.chart1.setDrawCenterText(!binding.chart1.isDrawCenterTextEnabled) + binding.chart1.isDrawCenterText = !binding.chart1.isDrawCenterText binding.chart1.invalidate() } R.id.actionToggleXValues -> { - binding.chart1.setDrawEntryLabels(!binding.chart1.isDrawEntryLabelsEnabled) + binding.chart1.isDrawEntryLabels = !binding.chart1.isDrawEntryLabels binding.chart1.invalidate() } R.id.actionTogglePercent -> { - binding.chart1.setUsePercentValues(!binding.chart1.isUsePercentValuesEnabled) + binding.chart1.isUsePercentValues = !binding.chart1.isUsePercentValues binding.chart1.invalidate() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/RadarChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/RadarChartActivity.kt index 75645bc07..ef4cbb62c 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/RadarChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/RadarChartActivity.kt @@ -107,19 +107,19 @@ class RadarChartActivity : DemoBase() { val set1 = RadarDataSet(entries1, "Last Week") set1.color = Color.rgb(103, 110, 129) set1.fillColor = Color.rgb(103, 110, 129) - set1.isDrawFilledEnabled = true + set1.isDrawFilled = true set1.fillAlpha = 180 set1.lineWidth = 2f - set1.isDrawHighlightCircleEnabled = true + set1.isDrawHighlightCircle = true set1.setDrawHighlightIndicators(false) val set2 = RadarDataSet(entries2, "This Week") set2.color = Color.rgb(121, 162, 175) set2.fillColor = Color.rgb(121, 162, 175) - set2.isDrawFilledEnabled = true + set2.isDrawFilled = true set2.fillAlpha = 180 set2.lineWidth = 2f - set2.isDrawHighlightCircleEnabled = true + set2.isDrawHighlightCircle = true set2.setDrawHighlightIndicators(false) val sets = ArrayList() @@ -165,7 +165,7 @@ class RadarChartActivity : DemoBase() { R.id.actionToggleHighlight -> { binding.chart1.data?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } @@ -177,14 +177,14 @@ class RadarChartActivity : DemoBase() { R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } R.id.actionToggleHighlightCircle -> { binding.chart1.data?.dataSets?.forEach { set -> - set.isDrawHighlightCircleEnabled = !set.isDrawHighlightCircleEnabled + set.isDrawHighlightCircle = !set.isDrawHighlightCircle } binding.chart1.invalidate() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt index ec29eede4..765581ca6 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/RealtimeLineChartActivity.kt @@ -45,7 +45,7 @@ class RealtimeLineChartActivity : DemoBase(), OnChartValueSelectedListener { binding.chart1.setDrawGridBackground(false) // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(true) + binding.chart1.isPinchZoom = true // set an alternative background color binding.chart1.setBackgroundColor(Color.LTGRAY) @@ -66,8 +66,8 @@ class RealtimeLineChartActivity : DemoBase(), OnChartValueSelectedListener { val xl = binding.chart1.xAxis xl.typeface = tfLight xl.textColor = Color.WHITE - xl.setDrawGridLines(false) - xl.setAvoidFirstLastClipping(true) + xl.isDrawGridLines = false + xl.isAvoidFirstLastClipping = true xl.isEnabled = true val leftAxis = binding.chart1.axisLeft @@ -75,7 +75,7 @@ class RealtimeLineChartActivity : DemoBase(), OnChartValueSelectedListener { leftAxis.textColor = Color.WHITE leftAxis.axisMaximum = 100f leftAxis.axisMinimum = 0f - leftAxis.setDrawGridLines(true) + leftAxis.isDrawGridLines = true val rightAxis = binding.chart1.axisRight rightAxis.isEnabled = false diff --git a/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt index db0923889..bf4ba14c6 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/ScatterChartActivity.kt @@ -48,7 +48,7 @@ class ScatterChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSe binding.chart1.setScaleEnabled(true) binding.chart1.setMaxVisibleValueCount(200) - binding.chart1.setPinchZoom(true) + binding.chart1.isPinchZoom = true binding.seekBarX.progress = 45 binding.seekBarY.progress = 100 @@ -70,7 +70,7 @@ class ScatterChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSe val xl = binding.chart1.xAxis xl.typeface = tfLight - xl.setDrawGridLines(false) + xl.isDrawGridLines = false } override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { @@ -149,19 +149,18 @@ class ScatterChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSe R.id.actionToggleHighlight -> { binding.chart1.scatterData?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) - + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/ScrollViewActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/ScrollViewActivity.kt index f6abbbf36..f17f8975e 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/ScrollViewActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/ScrollViewActivity.kt @@ -26,16 +26,16 @@ class ScrollViewActivity : DemoBase() { 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.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 binding.chart1.legend.isEnabled = false diff --git a/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt index 284369593..a5fa1ef75 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/SpecificPositionsLineChartActivity.kt @@ -61,7 +61,7 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, // mChart.setScaleYEnabled(true); // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(true) + binding.chart1.isPinchZoom = true // set an alternative background color // mChart.setBackgroundColor(Color.GRAY); @@ -103,7 +103,7 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, leftAxis.axisMinimum = -50f //leftAxis.setYOffset(20f); leftAxis.enableGridDashedLine(10f, 10f, 0f) - leftAxis.setDrawZeroLine(false) + leftAxis.isDrawZeroLine = false leftAxis.isShowSpecificPositions = true leftAxis.specificPositions = floatArrayOf(0f, 10f, 20f, 50f, 100f, 300f) @@ -136,7 +136,7 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, R.id.actionToggleHighlight -> { binding.chart1.data?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } @@ -144,7 +144,7 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, R.id.actionToggleFilled -> { binding.chart1.data?.dataSets?.forEach { val set = it as LineDataSet - set.isDrawFilledEnabled = !set.isDrawFilledEnabled + set.isDrawFilled = !set.isDrawFilled } binding.chart1.invalidate() } @@ -182,12 +182,12 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) + 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() } @@ -258,7 +258,7 @@ class SpecificPositionsLineChartActivity : DemoBase(), OnSeekBarChangeListener, set11.circleRadius = 3f set11.isDrawCircleHoleEnabled = false set11.valueTextSize = 9f - set11.isDrawFilledEnabled = true + set11.isDrawFilled = true set11.formLineWidth = 1f set11.formLineDashEffect = DashPathEffect(floatArrayOf(10f, 5f), 0f) set11.formSize = 15f diff --git a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt index b4c93b716..21c5bcbfe 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivity.kt @@ -50,13 +50,13 @@ class StackedBarActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSele binding.chart1.setMaxVisibleValueCount(40) // scaling can now only be done on x- and y-axis separately - binding.chart1.setPinchZoom(false) + binding.chart1.isPinchZoom = false binding.chart1.setDrawGridBackground(false) - binding.chart1.setDrawBarShadow(false) + binding.chart1.isDrawBarShadow = false - binding.chart1.setDrawValueAboveBar(false) - binding.chart1.isHighlightFullBarEnabled = false + binding.chart1.isDrawValueAboveBar = false + binding.chart1.isHighlightFullBar = false // change the position of the y-labels val leftAxis = binding.chart1.axisLeft @@ -166,19 +166,18 @@ class StackedBarActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSele R.id.actionToggleHighlight -> { binding.chart1.barData?.let { - it.isHighlightEnabled = !it.isHighlightEnabled + it.isHighlight = !it.isHighlight } binding.chart1.invalidate() } R.id.actionTogglePinch -> { - binding.chart1.setPinchZoom(!binding.chart1.isPinchZoomEnabled) - + 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt index 82a7a9428..accf2d40b 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/StackedBarActivityNegative.kt @@ -43,25 +43,25 @@ class StackedBarActivityNegative : DemoBase(), OnChartValueSelectedListener { 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.setDrawBarShadow(false) - binding.chart1.setDrawValueAboveBar(true) - binding.chart1.isHighlightFullBarEnabled = false + binding.chart1.isDrawBarShadow = false + binding.chart1.isDrawValueAboveBar = true + binding.chart1.isHighlightFullBar = false binding.chart1.axisLeft.isEnabled = false binding.chart1.axisRight.axisMaximum = 25f binding.chart1.axisRight.axisMinimum = -25f - binding.chart1.axisRight.setDrawGridLines(false) - binding.chart1.axisRight.setDrawZeroLine(true) + binding.chart1.axisRight.isDrawGridLines = false + binding.chart1.axisRight.isDrawZeroLine = true binding.chart1.axisRight.setLabelCount(7, false) binding.chart1.axisRight.valueFormatter = CustomFormatter() binding.chart1.axisRight.textSize = 9f val xAxis = binding.chart1.xAxis xAxis.position = XAxisPosition.BOTH_SIDED - xAxis.setDrawGridLines(false) - xAxis.setDrawAxisLine(false) + xAxis.isDrawGridLines = false + xAxis.isDrawAxisLine = false xAxis.textSize = 9f xAxis.axisMinimum = 0f xAxis.axisMaximum = 110f @@ -145,23 +145,18 @@ class StackedBarActivityNegative : DemoBase(), OnChartValueSelectedListener { 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() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/TimeLineActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/TimeLineActivity.kt index e59c93fe6..3da017b75 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/TimeLineActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/TimeLineActivity.kt @@ -53,14 +53,14 @@ class TimeLineActivity : DemoBase() { position = XAxisPosition.BOTTOM typeface = tfLight labelRotationAngle = 45f - setDrawGridLines(false) + isDrawGridLines = false // granularity = 1f // only intervals of 1 day labelCount = 7 valueFormatter = UnixTimeAxisValueFormatter("HH:mm:ss") } // if disabled, scaling can be done on x- and y-axis separately - binding.chart1.setPinchZoom(false) + binding.chart1.isPinchZoom = false binding.chart1.legend.apply { isEnabled = false @@ -70,9 +70,9 @@ class TimeLineActivity : DemoBase() { binding.chart1.axisLeft.apply { axisMaximum = 150f axisMinimum = -50f - setDrawAxisLine(true) - setDrawZeroLine(true) - setDrawGridLines(true) + isDrawAxisLine = true + isDrawZeroLine = true + isDrawGridLines = true } binding.chart1.axisRight.isEnabled = false @@ -108,7 +108,7 @@ class TimeLineActivity : DemoBase() { set1.lineWidth = 2f set1.circleRadius = 3f set1.fillAlpha = 255 - set1.isDrawFilledEnabled = true + set1.isDrawFilled = true set1.fillColor = Color.WHITE set1.highLightColor = Color.rgb(244, 117, 117) set1.isDrawCircleHoleEnabled = false diff --git a/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt index 4a555df6e..af8d6733d 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/compose/HorizontalBarComposeActivity.kt @@ -288,32 +288,32 @@ class HorizontalBarComposeActivity : DemoBaseCompose() { override fun onNothingSelected() = Unit }) - chart.setDrawBarShadow(false) - chart.setDrawValueAboveBar(true) + chart.isDrawBarShadow = false + chart.isDrawValueAboveBar = true chart.description.isEnabled = false chart.setMaxVisibleValueCount(60) - chart.setPinchZoom(false) + chart.isPinchZoom = false chart.setDrawGridBackground(false) val xl = chart.xAxis xl.position = XAxisPosition.BOTTOM xl.typeface = tfLight - xl.setDrawAxisLine(true) - xl.setDrawGridLines(false) + xl.isDrawAxisLine = true + xl.isDrawGridLines = false xl.granularity = 10f chart.axisLeft.apply { typeface = tfLight - setDrawAxisLine(true) - setDrawGridLines(true) + isDrawAxisLine = true + isDrawGridLines = true axisMinimum = 0f } chart.axisRight.apply { typeface = tfLight - setDrawAxisLine(true) - setDrawGridLines(false) + isDrawAxisLine = true + isDrawGridLines = false axisMinimum = 0f } @@ -395,18 +395,18 @@ class HorizontalBarComposeActivity : DemoBaseCompose() { private fun toggleHighlight() { val chartData = chart?.barData if (chartData != null) { - chartData.isHighlightEnabled = !chartData.isHighlightEnabled + chartData.isHighlight = !chartData.isHighlight chart?.invalidate() } } private fun togglePinchZoom() { - chart?.isPinchZoomEnabled?.let { chart?.setPinchZoom(!it) } + chart?.isPinchZoom?.let { chart?.isPinchZoom = !it } chart?.invalidate() } private fun toggleAutoScaleMinMax() { - chart?.isAutoScaleMinMaxEnabled?.let { chart?.isAutoScaleMinMaxEnabled = !it } + chart?.isAutoScaleMinMax?.let { chart?.isAutoScaleMinMax = !it } chart?.notifyDataSetChanged() } diff --git a/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt b/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt index 2ede03704..2d5b321e9 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/fragments/BarChartFrag.kt @@ -41,7 +41,7 @@ class BarChartFrag : SimpleFragment(), OnChartGestureListener { chart.setMarker(mv) chart.setDrawGridBackground(false) - chart.setDrawBarShadow(false) + chart.isDrawBarShadow = false val tf = Typeface.createFromAsset(requireContext().assets, "OpenSans-Light.ttf") diff --git a/app/src/main/kotlin/info/appdev/chartexample/fragments/ScatterChartFrag.kt b/app/src/main/kotlin/info/appdev/chartexample/fragments/ScatterChartFrag.kt index f85adcdad..4264617fe 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/fragments/ScatterChartFrag.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/fragments/ScatterChartFrag.kt @@ -45,7 +45,7 @@ class ScatterChartFrag : SimpleFragment() { val rightAxis = binding.scatterChart1.axisRight rightAxis.typeface = tf - rightAxis.setDrawGridLines(false) + rightAxis.isDrawGridLines = false binding.scatterChart1.legend.apply { isWordWrapEnabled = true diff --git a/app/src/main/kotlin/info/appdev/chartexample/listviewitems/BarChartItem.kt b/app/src/main/kotlin/info/appdev/chartexample/listviewitems/BarChartItem.kt index 59fa91296..a4732c1c2 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/listviewitems/BarChartItem.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/listviewitems/BarChartItem.kt @@ -37,13 +37,13 @@ class BarChartItem(chartData: BarData, context: Context) : ChartItem(ch // apply styling holder.chart!!.description.isEnabled = false holder.chart!!.setDrawGridBackground(false) - holder.chart!!.setDrawBarShadow(false) + holder.chart!!.isDrawBarShadow = false val xAxis = holder.chart!!.xAxis xAxis.position = XAxisPosition.BOTTOM xAxis.typeface = typeface - xAxis.setDrawGridLines(false) - xAxis.setDrawAxisLine(true) + xAxis.isDrawGridLines = false + xAxis.isDrawAxisLine = true val leftAxis = holder.chart!!.axisLeft leftAxis.typeface = typeface diff --git a/app/src/main/kotlin/info/appdev/chartexample/listviewitems/LineChartItem.kt b/app/src/main/kotlin/info/appdev/chartexample/listviewitems/LineChartItem.kt index 86c328495..2a8ba102c 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/listviewitems/LineChartItem.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/listviewitems/LineChartItem.kt @@ -42,8 +42,8 @@ class LineChartItem(lineData: LineData, context: Context) : ChartItem( val xAxis = holder.chart!!.xAxis xAxis.position = XAxisPosition.BOTTOM xAxis.typeface = typeface - xAxis.setDrawGridLines(false) - xAxis.setDrawAxisLine(true) + xAxis.isDrawGridLines = false + xAxis.isDrawAxisLine = true val leftAxis = holder.chart!!.axisLeft leftAxis.typeface = typeface @@ -53,7 +53,7 @@ class LineChartItem(lineData: LineData, context: Context) : ChartItem( val rightAxis = holder.chart!!.axisRight rightAxis.typeface = typeface rightAxis.setLabelCount(5, false) - rightAxis.setDrawGridLines(false) + rightAxis.isDrawGridLines = false rightAxis.axisMinimum = 0f // this replaces setStartAtZero(true) holder.chart!!.data = chartData diff --git a/app/src/main/kotlin/info/appdev/chartexample/listviewitems/PieChartItem.kt b/app/src/main/kotlin/info/appdev/chartexample/listviewitems/PieChartItem.kt index 174848104..7d6a59e14 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/listviewitems/PieChartItem.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/listviewitems/PieChartItem.kt @@ -53,7 +53,7 @@ class PieChartItem(pieData: PieData, context: Context) : ChartItem(pieD holder.chart!!.centerText = centerText holder.chart!!.setCenterTextTypeface(typeface) holder.chart!!.setCenterTextSize(9f) - holder.chart!!.setUsePercentValues(true) + holder.chart!!.isUsePercentValues = true holder.chart!!.setExtraOffsets(5f, 10f, 50f, 10f) chartData.setValueFormatter(PercentFormatter()) diff --git a/chartLib/src/main/kotlin/info/appdev/charting/charts/BarChart.kt b/chartLib/src/main/kotlin/info/appdev/charting/charts/BarChart.kt index 136edc7a6..a33a9c406 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/charts/BarChart.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/charts/BarChart.kt @@ -24,17 +24,17 @@ open class BarChart : BarLineChartBase, BarDataProvider { * was tapped. * Default: false */ - override var isHighlightFullBarEnabled: Boolean = false + override var isHighlightFullBar = false /** * if set to true, all values are drawn above their bars, instead of below their top */ - override var isDrawValueAboveBarEnabled: Boolean = true + override var isDrawValueAboveBar = true /** * if set to true, a grey area is drawn behind each bar that indicates the maximum value */ - override var isDrawBarShadowEnabled: Boolean = false + override var isDrawBarShadow = false /** * if set to true, the bar chart's bars would be round on all corners instead of rectangular @@ -96,7 +96,7 @@ open class BarChart : BarLineChartBase, BarDataProvider { } else { highlighter?.let { val h = it.getHighlight(x, y) - if (h == null || !isHighlightFullBarEnabled) + if (h == null || !isHighlightFullBar) return h // For isHighlightFullBarEnabled, remove stackIndex @@ -178,21 +178,6 @@ open class BarChart : BarLineChartBase, BarDataProvider { } } - /** - * If set to true, all values are drawn above their bars, instead of below their top. - */ - fun setDrawValueAboveBar(enabled: Boolean) { - this.isDrawValueAboveBarEnabled = enabled - } - - /** - * If set to true, a grey area is drawn behind each bar that indicates the maximum value. Enabling his will reduce - * performance by about 50%. - */ - fun setDrawBarShadow(enabled: Boolean) { - this.isDrawBarShadowEnabled = enabled - } - /** * Highlights the value at the given x-value in the given DataSet. Provide * -1 as the dataSetIndex to undo all highlighting. diff --git a/chartLib/src/main/kotlin/info/appdev/charting/charts/BarLineChartBase.kt b/chartLib/src/main/kotlin/info/appdev/charting/charts/BarLineChartBase.kt index 0d82d7b1c..a6d4123cc 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/charts/BarLineChartBase.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/charts/BarLineChartBase.kt @@ -59,14 +59,16 @@ abstract class BarLineChartBase, CombinedDataProvider /** * if set to true, all values are drawn above their bars, instead of below their top */ - var isDrawValueAboveBarEnabled: Boolean = true - + var isDrawValueAboveBar = true /** * Set this to true to make the highlight operation full-bar oriented, * false to make it highlight single values (relevant only for stacked). */ - var isHighlightFullBarEnabled: Boolean = false + var isHighlightFullBar = false /** * if set to true, a grey area is drawn behind each bar that indicates the maximum value */ - var isDrawBarShadowEnabled: Boolean = false + var isDrawBarShadow = false - protected var drawOrders: MutableList? = null + protected var mDrawOrders: MutableList? = null lateinit var barDataProvider: BarDataProvider lateinit var lineDataProvider: LineDataProvider @@ -69,7 +68,7 @@ open class CombinedChart : BarLineChartBase, CombinedDataProvider super.init() // Default values are not ready here yet - drawOrders = mutableListOf( + mDrawOrders = mutableListOf( DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.LINE, DrawOrder.CANDLE, DrawOrder.SCATTER ) @@ -78,22 +77,22 @@ open class CombinedChart : BarLineChartBase, CombinedDataProvider override val barData: BarData? get() = this@CombinedChart.barData - override var isDrawBarShadowEnabled: Boolean - get() = this@CombinedChart.isDrawBarShadowEnabled + override var isDrawBarShadow: Boolean + get() = this@CombinedChart.isDrawBarShadow set(value) { - this@CombinedChart.isDrawBarShadowEnabled = value + this@CombinedChart.isDrawBarShadow = value } - override var isDrawValueAboveBarEnabled: Boolean - get() = this@CombinedChart.isDrawValueAboveBarEnabled + override var isDrawValueAboveBar: Boolean + get() = this@CombinedChart.isDrawValueAboveBar set(value) { - this@CombinedChart.isDrawValueAboveBarEnabled = value + this@CombinedChart.isDrawValueAboveBar = value } - override var isHighlightFullBarEnabled: Boolean - get() = this@CombinedChart.isHighlightFullBarEnabled + override var isHighlightFullBar: Boolean + get() = this@CombinedChart.isHighlightFullBar set(value) { - this@CombinedChart.isHighlightFullBarEnabled = value + this@CombinedChart.isHighlightFullBar = value } override var data: BarData? @@ -376,7 +375,7 @@ open class CombinedChart : BarLineChartBase, CombinedDataProvider setHighlighter(CombinedHighlighter(this, barDataProvider)) // Old default behaviour - isHighlightFullBarEnabled = true + this@CombinedChart.isHighlightFullBar = true dataRenderer = CombinedChartRenderer(this, mAnimator, viewPortHandler) } @@ -395,7 +394,7 @@ open class CombinedChart : BarLineChartBase, CombinedDataProvider } else { highlighter?.let { val highlight = it.getHighlight(x, y) - if (highlight == null || !isHighlightFullBarEnabled) { + if (highlight == null || !isHighlightFullBar) { return highlight } @@ -454,22 +453,6 @@ open class CombinedChart : BarLineChartBase, CombinedDataProvider return mData!!.bubbleData } - /** - * If set to true, all values are drawn above their bars, instead of below their top. - */ - fun setDrawValueAboveBar(enabled: Boolean) { - this.isDrawValueAboveBarEnabled = enabled - } - - - /** - * If set to true, a grey area is drawn behind each bar that indicates the - * maximum value. Enabling his will reduce performance by about 50%. - */ - fun setDrawBarShadow(value: Boolean) { - this.isDrawBarShadowEnabled = value - } - /** * The order in which the provided data objects should be drawn. The * earlier you place them in the provided array, the further they will be in @@ -477,12 +460,12 @@ open class CombinedChart : BarLineChartBase, CombinedDataProvider * DrawOrder.LINE }, the bars will be drawn behind the lines. */ var drawOrder: MutableList? - get() = drawOrders + get() = mDrawOrders set(value) { if (value == null || value.isEmpty()) { return } - drawOrders = value + mDrawOrders = value } /** diff --git a/chartLib/src/main/kotlin/info/appdev/charting/charts/PieChart.kt b/chartLib/src/main/kotlin/info/appdev/charting/charts/PieChart.kt index 032864a51..2fa64bb5f 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/charts/PieChart.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/charts/PieChart.kt @@ -37,14 +37,12 @@ open class PieChart : PieRadarChartBase { /** * flag indicating if entry labels should be drawn or not */ - var isDrawEntryLabelsEnabled: Boolean = true - private set + var isDrawEntryLabels = true /** * returns an integer array of all the different angles the chart slices * have the angles in the returned array determine how much space (of 360°) * each slice takes - * */ var drawAngles: FloatArray = FloatArray(1) private set @@ -60,7 +58,7 @@ open class PieChart : PieRadarChartBase { * returns true if the hole in the center of the pie-chart is set to be * visible, false if not */ - var isDrawHoleEnabled: Boolean = true + var isDrawHole = true /** * Returns true if the inner tips of the slices are visible behind the hole, @@ -68,21 +66,22 @@ open class PieChart : PieRadarChartBase { * * @return true if slices are visible behind the hole. */ - var isDrawSlicesUnderHoleEnabled: Boolean = false - private set + var isDrawSlicesUnderHole = false /** - * Returns true if using percentage values is enabled for the chart. + * If this is enabled, values inside the PieChart are drawn in percent and + * not with their original value. Values provided for the IValueFormatter to + * format are then provided in percent. */ - var isUsePercentValuesEnabled: Boolean = false - private set + var isUsePercentValues = false /** * Returns true if the chart is set to draw each end of a pie-slice * "rounded". + * Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled + * and if the slices are not drawn under the hole. */ - var isDrawRoundedSlicesEnabled: Boolean = false - private set + var isDrawRoundedSlices: Boolean = false /** * variable for the text that is drawn in the center of the pie-chart @@ -106,27 +105,22 @@ open class PieChart : PieRadarChartBase { * whole chart), default 55% -> means 5% larger than the center-hole by * default */ - var transparentCircleRadius: Float = 55f + var transparentCircleRadius = 55f /** * returns true if drawing the center text is enabled */ - var isDrawCenterTextEnabled: Boolean = true - private set + var isDrawCenterText = true + /** * the rectangular radius of the bounding box for the center text, as a percentage of the pie * hole * default 1.f (100%) */ - /** - * the rectangular radius of the bounding box for the center text, as a percentage of the pie - * hole - * default 1.f (100%) - */ - var centerTextRadiusPercent: Float = 100f + var centerTextRadiusPercent = 100f - protected var mMaxAngle: Float = 360f + protected var mMaxAngle = 360f /** * Minimum angle to draw slices, this only works if there is enough room for all slices to have @@ -201,7 +195,7 @@ open class PieChart : PieRadarChartBase { var off = r / 10f * 3.6f - if (this.isDrawHoleEnabled) { + if (this.isDrawHole) { off = (r - (r / 100f * this.holeRadius)) / 2f } @@ -378,13 +372,6 @@ open class PieChart : PieRadarChartBase { (dataRenderer as PieChartRenderer).paintHole.color = color } - /** - * Enable or disable the visibility of the inner tips of the slices behind the hole - */ - fun setDrawSlicesUnderHole(enable: Boolean) { - this.isDrawSlicesUnderHoleEnabled = enable - } - var centerText: CharSequence? /** * returns the text that is drawn in the center of the pie-chart @@ -397,14 +384,6 @@ open class PieChart : PieRadarChartBase { mCenterText = Objects.requireNonNullElse(text, "") } - /** - * set this to true to draw the text that is displayed in the center of the - * pie chart - */ - fun setDrawCenterText(enabled: Boolean) { - this.isDrawCenterTextEnabled = enabled - } - override val requiredLegendOffset: Float get() { legendRenderer?.let { @@ -484,23 +463,6 @@ open class PieChart : PieRadarChartBase { (dataRenderer as PieChartRenderer).paintTransparentCircle.alpha = alpha } - /** - * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). - * Deprecated -> use setDrawEntryLabels(...) instead. - */ - @Deprecated("use setDrawEntryLabels(...) instead.") - fun setDrawSliceText(enabled: Boolean) { - this.isDrawEntryLabelsEnabled = enabled - } - - /** - * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). - * - */ - fun setDrawEntryLabels(enabled: Boolean) { - this.isDrawEntryLabelsEnabled = enabled - } - /** * Sets the color the entry labels are drawn with. * @@ -525,26 +487,6 @@ open class PieChart : PieRadarChartBase { (dataRenderer as PieChartRenderer).paintEntryLabels.textSize = size.convertDpToPixel() } - /** - * Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled - * and if the slices are not drawn under the hole. - * - * @param enabled draw curved ends of slices - */ - fun setDrawRoundedSlices(enabled: Boolean) { - this.isDrawRoundedSlicesEnabled = enabled - } - - /** - * If this is enabled, values inside the PieChart are drawn in percent and - * not with their original value. Values provided for the IValueFormatter to - * format are then provided in percent. - * - */ - fun setUsePercentValues(enabled: Boolean) { - this.isUsePercentValuesEnabled = enabled - } - var maxAngle: Float get() = mMaxAngle /** diff --git a/chartLib/src/main/kotlin/info/appdev/charting/components/AxisBase.kt b/chartLib/src/main/kotlin/info/appdev/charting/components/AxisBase.kt index 66e54e7da..d2f8fbe1e 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/components/AxisBase.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/components/AxisBase.kt @@ -24,7 +24,7 @@ abstract class AxisBase : ComponentBase() { * coming from each label). */ @ColorInt - var gridColor: Int = Color.GRAY + var gridColor = Color.GRAY private var mGridLineWidth = 1f @@ -32,7 +32,7 @@ abstract class AxisBase : ComponentBase() { * Returns the color of the axis line (line alongside the axis). */ @ColorInt - var axisLineColor: Int = Color.GRAY + var axisLineColor = Color.GRAY private var mAxisLineWidth = 1f @@ -49,12 +49,12 @@ abstract class AxisBase : ComponentBase() { /** * the number of entries the legend contains */ - var entryCount: Int = 0 + var entryCount = 0 /** * the number of decimal digits to use */ - var decimals: Int = 0 + var decimals = 0 /** * the number of label entries the axis should have, default 6 @@ -64,7 +64,7 @@ abstract class AxisBase : ComponentBase() { /** * the minimum interval between axis values */ - protected var mGranularity: Float = 1.0f + protected var mGranularity = 1.0f /** * When true, axis labels are controlled by the `granularity` property. @@ -72,30 +72,28 @@ abstract class AxisBase : ComponentBase() { * This could happen if two adjacent axis values are rounded to same value. * If using granularity this could be avoided by having fewer axis values visible. */ - var isGranularityEnabled: Boolean = false + var isGranularity = false /** * if true, the set number of y-labels will be forced */ - var isForceLabelsEnabled: Boolean = false + var isForceLabels = false protected set /** * flag indicating if the grid lines for this axis should be drawn */ - var isDrawGridLinesEnabled: Boolean = true - protected set + var isDrawGridLines = true /** * flag that indicates if the line alongside the axis is drawn or not */ - var isDrawAxisLineEnabled: Boolean = true - protected set + var isDrawAxisLine = true /** * flag that indicates of the labels of this axis should be drawn or not */ - var isDrawLabelsEnabled: Boolean = true + var isDrawLabelsEnabled = true protected set protected var mCenterAxisLabels: Boolean = false @@ -214,20 +212,6 @@ abstract class AxisBase : ComponentBase() { this.limitRanges = ArrayList() } - /** - * Set this to true to enable drawing the grid lines for this axis. - */ - fun setDrawGridLines(enabled: Boolean) { - this.isDrawGridLinesEnabled = enabled - } - - /** - * Set this to true if the line alongside the axis should be drawn or not. - */ - fun setDrawAxisLine(enabled: Boolean) { - this.isDrawAxisLineEnabled = enabled - } - /** * Centers the axis labels instead of drawing them at their original position. * This is useful especially for grouped BarChart. @@ -278,7 +262,7 @@ abstract class AxisBase : ComponentBase() { */ fun setLabelCount(count: Int, force: Boolean) { this.labelCount = count - this.isForceLabelsEnabled = force + this.isForceLabels = force } /** @@ -295,7 +279,7 @@ abstract class AxisBase : ComponentBase() { count = this.axisMinLabels mLabelCount = count - this.isForceLabelsEnabled = false + this.isForceLabels = false } /** @@ -307,7 +291,7 @@ abstract class AxisBase : ComponentBase() { set(granularity) { mGranularity = granularity // set this to true if it was disabled, as it makes no sense to call this method with granularity disabled - this.isGranularityEnabled = true + this.isGranularity = true } /** diff --git a/chartLib/src/main/kotlin/info/appdev/charting/components/XAxis.kt b/chartLib/src/main/kotlin/info/appdev/charting/components/XAxis.kt index 2af601f78..cb93037a3 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/components/XAxis.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/components/XAxis.kt @@ -30,8 +30,7 @@ class XAxis : AxisBase() { * if set to true, the chart will avoid that the first and last label entry * in the chart "clip" off the edge of the chart */ - var isAvoidFirstLastClippingEnabled: Boolean = false - private set + var isAvoidFirstLastClipping = false /** * the position of the x-labels relative to the chart @@ -49,11 +48,4 @@ class XAxis : AxisBase() { mYOffset = 4f.convertDpToPixel() // -3 } - /** - * if set to true, the chart will avoid that the first and last label entry - * in the chart "clip" off the edge of the chart or the screen - */ - fun setAvoidFirstLastClipping(enabled: Boolean) { - this.isAvoidFirstLastClippingEnabled = enabled - } } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/components/YAxis.kt b/chartLib/src/main/kotlin/info/appdev/charting/components/YAxis.kt index f2b6b2403..16ad70347 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/components/YAxis.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/components/YAxis.kt @@ -38,8 +38,7 @@ open class YAxis : AxisBase { /** * flag that indicates if the zero-line should be drawn regardless of other grid lines */ - var isDrawZeroLineEnabled: Boolean = false - protected set + var isDrawZeroLine: Boolean = false /** * Color of the zero line @@ -127,14 +126,6 @@ open class YAxis : AxisBase { else resetAxisMinimum() } - /** - * Set this to true to draw the zero-line regardless of weather other - * grid-lines are enabled or not. Default: false - */ - fun setDrawZeroLine(mDrawZeroLine: Boolean) { - this.isDrawZeroLineEnabled = mDrawZeroLine - } - var zeroLineWidth: Float get() = mZeroLineWidth set(width) { diff --git a/chartLib/src/main/kotlin/info/appdev/charting/data/BaseDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/data/BaseDataSet.kt index 025d80f5e..a186c6eb3 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/data/BaseDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/data/BaseDataSet.kt @@ -45,7 +45,7 @@ abstract class BaseDataSet() : IDataSet { /** * if true, value highlighting is enabled */ - protected var mHighlightEnabled: Boolean = true + protected var mIsHighlight: Boolean = true /** * custom formatter that is used instead of the auto-formatter if set @@ -241,10 +241,10 @@ abstract class BaseDataSet() : IDataSet { mAxisDependency = value } - override var isHighlightEnabled: Boolean - get() = mHighlightEnabled + override var isHighlight: Boolean + get() = mIsHighlight set(value) { - mHighlightEnabled = value + mIsHighlight = value } override var valueFormatter: IValueFormatter @@ -360,7 +360,7 @@ abstract class BaseDataSet() : IDataSet { baseDataSet.mFormLineDashEffect = mFormLineDashEffect baseDataSet.formLineWidth = formLineWidth baseDataSet.mFormSize = mFormSize - baseDataSet.mHighlightEnabled = mHighlightEnabled + baseDataSet.mIsHighlight = mIsHighlight baseDataSet.mIconsOffset = mIconsOffset baseDataSet.mValueColors = mValueColors baseDataSet.mValueFormatter = mValueFormatter diff --git a/chartLib/src/main/kotlin/info/appdev/charting/data/ChartData.kt b/chartLib/src/main/kotlin/info/appdev/charting/data/ChartData.kt index 8e66d784b..bb4565974 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/data/ChartData.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/data/ChartData.kt @@ -586,10 +586,10 @@ abstract class ChartData> : Serializable { * Enables / disables highlighting values for all DataSets this data object * contains. If set to true, this means that values can be highlighted programmatically or by touch gesture. */ - var isHighlightEnabled: Boolean + var isHighlight: Boolean get() { for (set in this.dataSets) { - if (!set.isHighlightEnabled) { + if (!set.isHighlight) { return false } } @@ -597,7 +597,7 @@ abstract class ChartData> : Serializable { } set(value) { for (set in this.dataSets) { - set.isHighlightEnabled = value + set.isHighlight = value } } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/data/LineRadarDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/data/LineRadarDataSet.kt index fabb6c128..db3e59332 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/data/LineRadarDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/data/LineRadarDataSet.kt @@ -42,7 +42,7 @@ abstract class LineRadarDataSet(yVals: MutableList, label: String) /** * if true, the data will also be drawn filled */ - override var isDrawFilledEnabled: Boolean = false + override var isDrawFilled: Boolean = false override var fillColor: Int get() = mFillColor @@ -70,7 +70,7 @@ abstract class LineRadarDataSet(yVals: MutableList, label: String) protected fun copy(lineRadarDataSet: LineRadarDataSet<*>) { super.copy((lineRadarDataSet as BaseDataSet<*>?)!!) - lineRadarDataSet.isDrawFilledEnabled = this.isDrawFilledEnabled + lineRadarDataSet.isDrawFilled = this.isDrawFilled lineRadarDataSet.fillAlpha = this.fillAlpha lineRadarDataSet.mFillColor = mFillColor lineRadarDataSet.fillDrawable = this.fillDrawable diff --git a/chartLib/src/main/kotlin/info/appdev/charting/data/LineScatterCandleRadarDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/data/LineScatterCandleRadarDataSet.kt index f31b5587f..1f9535dff 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/data/LineScatterCandleRadarDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/data/LineScatterCandleRadarDataSet.kt @@ -6,10 +6,8 @@ import info.appdev.charting.utils.convertDpToPixel abstract class LineScatterCandleRadarDataSet(yVals: MutableList, label: String) : BarLineScatterCandleBubbleDataSet(yVals, label), ILineScatterCandleRadarDataSet { - override var isVerticalHighlightIndicatorEnabled: Boolean = true - protected set - override var isHorizontalHighlightIndicatorEnabled: Boolean = true - protected set + override var isVerticalHighlightIndicator: Boolean = true + override var isHorizontalHighlightIndicator: Boolean = true /** the width of the highlight indicator lines */ protected var mHighlightLineWidth: Float @@ -18,7 +16,6 @@ abstract class LineScatterCandleRadarDataSet(yVals: MutableList, l override var dashPathEffectHighlight: DashPathEffect? = null protected set - init { mHighlightLineWidth = 0.5f.convertDpToPixel() } @@ -26,30 +23,29 @@ abstract class LineScatterCandleRadarDataSet(yVals: MutableList, l /** * Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. */ + @Deprecated("Use property isHorizontalHighlightIndicator instead") fun setDrawHorizontalHighlightIndicator(enabled: Boolean) { - this.isHorizontalHighlightIndicatorEnabled = enabled + this.isHorizontalHighlightIndicator = enabled } /** * Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. */ + @Deprecated("Use property isVerticalHighlightIndicator instead") fun setDrawVerticalHighlightIndicator(enabled: Boolean) { - this.isVerticalHighlightIndicatorEnabled = enabled + this.isVerticalHighlightIndicator = enabled } /** * Enables / disables both vertical and horizontal highlight-indicators. */ fun setDrawHighlightIndicators(enabled: Boolean) { - setDrawVerticalHighlightIndicator(enabled) - setDrawHorizontalHighlightIndicator(enabled) + this.isHorizontalHighlightIndicator = enabled + this.isVerticalHighlightIndicator = enabled } override var highlightLineWidth: Float get() = mHighlightLineWidth - /** - * Sets the width of the highlight line in dp. - */ set(width) { mHighlightLineWidth = width.convertDpToPixel() } @@ -63,9 +59,8 @@ abstract class LineScatterCandleRadarDataSet(yVals: MutableList, l */ fun enableDashedHighlightLine(lineLength: Float, spaceLength: Float, phase: Float) { this.dashPathEffectHighlight = DashPathEffect( - floatArrayOf( - lineLength, spaceLength - ), phase + floatArrayOf(lineLength, spaceLength), + phase ) } @@ -85,8 +80,8 @@ abstract class LineScatterCandleRadarDataSet(yVals: MutableList, l protected fun copy(lineScatterCandleRadarDataSet: LineScatterCandleRadarDataSet<*>) { super.copy((lineScatterCandleRadarDataSet as BaseDataSet<*>?)!!) - lineScatterCandleRadarDataSet.isHorizontalHighlightIndicatorEnabled = this.isHorizontalHighlightIndicatorEnabled - lineScatterCandleRadarDataSet.isVerticalHighlightIndicatorEnabled = this.isVerticalHighlightIndicatorEnabled + lineScatterCandleRadarDataSet.isHorizontalHighlightIndicator = this.isHorizontalHighlightIndicator + lineScatterCandleRadarDataSet.isVerticalHighlightIndicator = this.isVerticalHighlightIndicator lineScatterCandleRadarDataSet.mHighlightLineWidth = mHighlightLineWidth lineScatterCandleRadarDataSet.dashPathEffectHighlight = this.dashPathEffectHighlight } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/data/PieDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/data/PieDataSet.kt index d3f263be7..717f9d6f7 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/data/PieDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/data/PieDataSet.kt @@ -94,7 +94,7 @@ open class PieDataSet(yVals: MutableList, label: String) : DataSet, label: String = "") : LineRadarDataSet(yVals, label), IRadarDataSet { /** flag indicating whether highlight circle should be drawn or not */ - protected var mDrawHighlightCircleEnabled: Boolean = false + protected var mIsDrawHighlightCircle: Boolean = false @ColorInt protected var mHighlightCircleFillColor: Int = Color.WHITE @@ -22,10 +22,10 @@ open class RadarDataSet(yVals: MutableList, label: String = "") : Li protected var mHighlightCircleOuterRadius: Float = 4.0f protected var mHighlightCircleStrokeWidth: Float = 2.0f - override var isDrawHighlightCircleEnabled: Boolean - get() = mDrawHighlightCircleEnabled + override var isDrawHighlightCircle: Boolean + get() = mIsDrawHighlightCircle set(value) { - mDrawHighlightCircleEnabled = value + mIsDrawHighlightCircle = value } override var highlightCircleFillColor: Int get() = mHighlightCircleFillColor @@ -70,7 +70,7 @@ open class RadarDataSet(yVals: MutableList, label: String = "") : Li protected fun copy(radarDataSet: RadarDataSet) { super.copy((radarDataSet as BaseDataSet<*>?)!!) - radarDataSet.mDrawHighlightCircleEnabled = mDrawHighlightCircleEnabled + radarDataSet.mIsDrawHighlightCircle = mIsDrawHighlightCircle radarDataSet.mHighlightCircleFillColor = mHighlightCircleFillColor radarDataSet.mHighlightCircleInnerRadius = mHighlightCircleInnerRadius radarDataSet.mHighlightCircleStrokeAlpha = mHighlightCircleStrokeAlpha diff --git a/chartLib/src/main/kotlin/info/appdev/charting/highlight/ChartHighlighter.kt b/chartLib/src/main/kotlin/info/appdev/charting/highlight/ChartHighlighter.kt index 254d884b7..3b6fb6653 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/highlight/ChartHighlighter.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/highlight/ChartHighlighter.kt @@ -97,7 +97,7 @@ open class ChartHighlighter>(prote // don't include DataSets that cannot be highlighted dataSet?.let { - if (!it.isHighlightEnabled) { + if (!it.isHighlight) { i++ continue } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/highlight/CombinedHighlighter.kt b/chartLib/src/main/kotlin/info/appdev/charting/highlight/CombinedHighlighter.kt index 743757b76..989c25a73 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/highlight/CombinedHighlighter.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/highlight/CombinedHighlighter.kt @@ -37,7 +37,7 @@ open class CombinedHighlighter(combinedDataProvider: CombinedDataProvider, barDa dataSet?.let { // don't include datasets that cannot be highlighted - if (!it.isHighlightEnabled) { + if (!it.isHighlight) { j++ continue } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/dataprovider/BarDataProvider.kt b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/dataprovider/BarDataProvider.kt index d12c70243..cd4b172c1 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/dataprovider/BarDataProvider.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/dataprovider/BarDataProvider.kt @@ -5,7 +5,7 @@ import info.appdev.charting.interfaces.dataprovider.base.BarLineScatterCandleBub interface BarDataProvider : BarLineScatterCandleBubbleDataProvider { val barData: BarData? - var isDrawBarShadowEnabled: Boolean - var isDrawValueAboveBarEnabled: Boolean - var isHighlightFullBarEnabled: Boolean + var isDrawBarShadow: Boolean + var isDrawValueAboveBar: Boolean + var isHighlightFullBar: Boolean } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IDataSet.kt index 58a6debe5..2b2a75a6c 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IDataSet.kt @@ -209,7 +209,7 @@ interface IDataSet { * If set to true, value highlighting is enabled which means that values can * be highlighted programmatically or by touch gesture. */ - var isHighlightEnabled: Boolean + var isHighlight: Boolean /** * Sets the formatter to be used for drawing the values inside the chart. If diff --git a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineRadarDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineRadarDataSet.kt index 5557c9fd6..d0ccfe7d9 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineRadarDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineRadarDataSet.kt @@ -28,6 +28,6 @@ interface ILineRadarDataSet : ILineScatterCandleRadarDataSet { /** * Returns true if filled drawing is enabled, false if not */ - var isDrawFilledEnabled: Boolean + var isDrawFilled: Boolean } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineScatterCandleRadarDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineScatterCandleRadarDataSet.kt index 83ff1115e..56cb22950 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineScatterCandleRadarDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/ILineScatterCandleRadarDataSet.kt @@ -7,12 +7,12 @@ interface ILineScatterCandleRadarDataSet : IBarLineScatterCandleBubbl /** * Returns true if vertical highlight indicator lines are enabled (drawn) */ - val isVerticalHighlightIndicatorEnabled: Boolean + val isVerticalHighlightIndicator: Boolean /** * Returns true if vertical highlight indicator lines are enabled (drawn) */ - val isHorizontalHighlightIndicatorEnabled: Boolean + val isHorizontalHighlightIndicator: Boolean /** * Returns the line-width in which highlight lines are to be drawn. diff --git a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IPieDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IPieDataSet.kt index 05cb075b0..fac8a18cd 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IPieDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IPieDataSet.kt @@ -34,7 +34,7 @@ interface IPieDataSet : IDataSet { /** * When valuePosition is OutsideSlice and enabled, line will have the same color as the slice */ - val isUseValueColorForLineEnabled: Boolean + val isUseValueColorForLine: Boolean /** * When valuePosition is OutsideSlice, indicates line width diff --git a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IRadarDataSet.kt b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IRadarDataSet.kt index c9e135631..986849fcf 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IRadarDataSet.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/interfaces/datasets/IRadarDataSet.kt @@ -5,7 +5,7 @@ import info.appdev.charting.data.RadarEntry interface IRadarDataSet : ILineRadarDataSet { /** flag indicating whether highlight circle should be drawn or not */ /** Sets whether highlight circle should be drawn or not */ - var isDrawHighlightCircleEnabled: Boolean + var isDrawHighlightCircle: Boolean val highlightCircleFillColor: Int diff --git a/chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt b/chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt index 36b98a3eb..8e79896f9 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt @@ -142,7 +142,7 @@ class BarLineChartTouchListener( savedDist = spacing(event) if (savedDist > 10f) { - touchMode = if (chart.isPinchZoomEnabled) { + touchMode = if (chart.isPinchZoom) { PINCH_ZOOM } else { if (chart.isScaleXEnabled != chart.isScaleYEnabled) { diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/AxisRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/AxisRenderer.kt index 3153d42b4..33ce42e2b 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/AxisRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/AxisRenderer.kt @@ -125,7 +125,7 @@ abstract class AxisRenderer( // If granularity is enabled, then do not allow the interval to go below specified granularity. // This is used to avoid repeated values when rounding values for display. - if (axis.isGranularityEnabled) interval = if (interval < axis.granularity) axis.granularity.toDouble() else interval + if (axis.isGranularity) interval = if (interval < axis.granularity) axis.granularity.toDouble() else interval // Normalize interval val intervalMagnitude = 10.0.pow(log10(interval).toInt().toDouble()).roundToNextSignificant().toDouble() @@ -141,11 +141,11 @@ abstract class AxisRenderer( var n = if (axis.isCenterAxisLabelsEnabled) 1 else 0 // force label count - if (axis.isForceLabelsEnabled) { + if (axis.isForceLabels) { interval = (range.toFloat() / (labelCount - 1).toFloat()).toDouble() // When force label is enabled // If granularity is enabled, then do not allow the interval to go below specified granularity. - if (axis.isGranularityEnabled) interval = if (interval < axis.granularity) axis.granularity.toDouble() else interval + if (axis.isGranularity) interval = if (interval < axis.granularity) axis.granularity.toDouble() else interval axis.entryCount = labelCount diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/BarChartRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/BarChartRenderer.kt index 91b44ab76..1eab91213 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/BarChartRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/BarChartRenderer.kt @@ -113,7 +113,7 @@ open class BarChartRenderer( val phaseY = animator.phaseY // draw the bar shadow before the values - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { shadowPaint.color = dataSet.barShadowColor dataProvider.barData?.let { barData -> @@ -256,7 +256,7 @@ open class BarChartRenderer( val valueOffsetPlus = 4.5f.convertDpToPixel() var posOffset: Float var negOffset: Float - val drawValueAboveBar = dataProvider.isDrawValueAboveBarEnabled + val drawValueAboveBar = dataProvider.isDrawValueAboveBar dataProvider.barData?.let { barData -> for (i in 0.. @@ -172,7 +172,7 @@ open class HorizontalBarChartRenderer( val valueOffsetPlus = 5f.convertDpToPixel() var posOffset: Float var negOffset: Float - val drawValueAboveBar = dataProvider.isDrawValueAboveBarEnabled + val drawValueAboveBar = dataProvider.isDrawValueAboveBar dataProvider.barData?.let { barData -> for (i in 0.. 0) { + if (dataSet.isDrawFilled && entryCount > 0) { drawLinearFill(c, dataSet, trans!!, xBounds) } @@ -645,7 +645,7 @@ open class LineChartRenderer( for (high in indices) { val set = lineData?.getDataSetByIndex(high.dataSetIndex) - if (set == null || !set.isHighlightEnabled) + if (set == null || !set.isHighlight) continue set.getEntryForXValue(high.x, high.y)?.let { entry -> diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/LineScatterCandleRadarRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/LineScatterCandleRadarRenderer.kt index d4e448e48..9cfe7bc7b 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/LineScatterCandleRadarRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/LineScatterCandleRadarRenderer.kt @@ -33,7 +33,7 @@ abstract class LineScatterCandleRadarRenderer( paintHighlight.pathEffect = set.dashPathEffectHighlight // draw vertical highlight lines - if (set.isVerticalHighlightIndicatorEnabled) { + if (set.isVerticalHighlightIndicator) { // create vertical path highlightLinePath.reset() @@ -44,7 +44,7 @@ abstract class LineScatterCandleRadarRenderer( } // draw horizontal highlight lines - if (set.isHorizontalHighlightIndicatorEnabled) { + if (set.isHorizontalHighlightIndicator) { // create horizontal path highlightLinePath.reset() diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/PieChartRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/PieChartRenderer.kt index e1d3f1fdb..7cc61e8a6 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/PieChartRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/PieChartRenderer.kt @@ -182,14 +182,14 @@ open class PieChartRenderer( val drawAngles = chart.drawAngles val center = chart.centerCircleBox val radius = chart.radius - val drawInnerArc = chart.isDrawHoleEnabled && !chart.isDrawSlicesUnderHoleEnabled + val drawInnerArc = chart.isDrawHole && !chart.isDrawSlicesUnderHole val userInnerRadius = if (drawInnerArc) radius * (chart.holeRadius / 100f) else 0f val roundedRadius = (radius - (radius * chart.holeRadius / 100f)) / 2f val roundedCircleBox = RectF() - val drawRoundedSlices = drawInnerArc && chart.isDrawRoundedSlicesEnabled + val drawRoundedSlices = drawInnerArc && chart.isDrawRoundedSlices var visibleAngleCount = 0 for (j in 0.. @@ -316,7 +316,7 @@ open class RadarChartRenderer( // draw the lines drawHighlightLines(canvas, pOut.x, pOut.y, set) - if (set.isDrawHighlightCircleEnabled) { + if (set.isDrawHighlightCircle) { if (!pOut.x.isNaN() && !pOut.y.isNaN()) { var strokeColor = set.highlightCircleStrokeColor if (strokeColor == ColorTemplate.COLOR_NONE) { diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedBarChartRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedBarChartRenderer.kt index e81259c46..8e8e28516 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedBarChartRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedBarChartRenderer.kt @@ -33,7 +33,7 @@ class RoundedBarChartRenderer( val phaseX = animator.phaseX val phaseY = animator.phaseY - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { shadowPaint.color = dataSet.barShadowColor dataProvider.barData?.let { barData -> val barWidth = barData.barWidth @@ -91,7 +91,7 @@ class RoundedBarChartRenderer( break } - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { if (roundedShadowRadius > 0) { canvas.drawRoundRect( RectF( @@ -141,7 +141,7 @@ class RoundedBarChartRenderer( break } - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { if (roundedShadowRadius > 0) { canvas.drawRoundRect( RectF( @@ -252,7 +252,7 @@ class RoundedBarChartRenderer( for (high in indices) { val set = barData.getDataSetByIndex(high.dataSetIndex) - if (set == null || !set.isHighlightEnabled) + if (set == null || !set.isHighlight) continue @@ -273,7 +273,7 @@ class RoundedBarChartRenderer( val y2: Float if (isStack) { - if (dataProvider.isHighlightFullBarEnabled) { + if (dataProvider.isHighlightFullBar) { y1 = barEntry.positiveSum y2 = -barEntry.negativeSum } else { diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedHorizontalBarChartRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedHorizontalBarChartRenderer.kt index c3a2ed380..5c6d2cacb 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedHorizontalBarChartRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/RoundedHorizontalBarChartRenderer.kt @@ -34,7 +34,7 @@ class RoundedHorizontalBarChartRenderer( val phaseX = animator.phaseX val phaseY = animator.phaseY - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { shadowPaint.color = dataSet.barShadowColor dataProvider.barData?.let { barData -> val barWidth = barData.barWidth @@ -89,7 +89,7 @@ class RoundedHorizontalBarChartRenderer( break } - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { if (roundedShadowRadius > 0) { canvas.drawRoundRect( RectF( @@ -139,7 +139,7 @@ class RoundedHorizontalBarChartRenderer( break } - if (dataProvider.isDrawBarShadowEnabled) { + if (dataProvider.isDrawBarShadow) { if (roundedShadowRadius > 0) { canvas.drawRoundRect( RectF( diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/ScatterChartRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/ScatterChartRenderer.kt index afb879666..cf4a1c10d 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/ScatterChartRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/ScatterChartRenderer.kt @@ -164,7 +164,7 @@ open class ScatterChartRenderer( for (high in indices) { val set = scatterData?.getDataSetByIndex(high.dataSetIndex) - if (set == null || !set.isHighlightEnabled) + if (set == null || !set.isHighlight) continue set.getEntryForXValue(high.x, high.y)?.let { entry -> diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRenderer.kt index 9bb8da387..0f4e10662 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRenderer.kt @@ -138,7 +138,7 @@ open class XAxisRenderer( } override fun renderAxisLine(canvas: Canvas) { - if (!xAxis.isDrawAxisLineEnabled || !xAxis.isEnabled) + if (!xAxis.isDrawAxisLine || !xAxis.isEnabled) return paintAxisLine.color = xAxis.axisLineColor @@ -206,7 +206,7 @@ open class XAxisRenderer( else xAxis.valueFormatter?.getFormattedValue(xAxis.entries[i / 2], xAxis) - if (xAxis.isAvoidFirstLastClippingEnabled) { + if (xAxis.isAvoidFirstLastClipping) { // avoid clipping of the last if (i / 2 == xAxis.entryCount - 1 && xAxis.entryCount > 1) { @@ -236,7 +236,7 @@ open class XAxisRenderer( protected open var renderGridLinesPath: Path = Path() protected open var renderGridLinesBuffer: FloatArray = FloatArray(2) override fun renderGridLines(canvas: Canvas) { - if (!xAxis.isDrawGridLinesEnabled || !xAxis.isEnabled) + if (!xAxis.isDrawGridLines || !xAxis.isEnabled) return canvas.withClip(gridClippingRect!!) { diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRendererHorizontalBarChart.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRendererHorizontalBarChart.kt index 6049392ed..781dd86cf 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRendererHorizontalBarChart.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/XAxisRendererHorizontalBarChart.kt @@ -178,7 +178,7 @@ open class XAxisRendererHorizontalBarChart( } override fun renderAxisLine(canvas: Canvas) { - if (!xAxis.isDrawAxisLineEnabled || !xAxis.isEnabled) + if (!xAxis.isDrawAxisLine || !xAxis.isEnabled) return paintAxisLine.color = xAxis.axisLineColor diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRenderer.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRenderer.kt index 35fcb00fb..5ab918c41 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRenderer.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRenderer.kt @@ -77,7 +77,7 @@ open class YAxisRenderer( } override fun renderAxisLine(canvas: Canvas) { - if (!yAxis.isEnabled || !yAxis.isDrawAxisLineEnabled) + if (!yAxis.isEnabled || !yAxis.isDrawAxisLine) return paintAxisLine.color = yAxis.axisLineColor @@ -141,7 +141,7 @@ open class YAxisRenderer( if (!yAxis.isEnabled) return - if (yAxis.isDrawGridLinesEnabled) { + if (yAxis.isDrawGridLines) { canvas.withClip(gridClippingRect!!) { val positions = transformedPositions @@ -163,7 +163,7 @@ open class YAxisRenderer( } } - if (yAxis.isDrawZeroLineEnabled) { + if (yAxis.isDrawZeroLine) { drawZeroLine(canvas) } } diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererHorizontalBarChart.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererHorizontalBarChart.kt index 7478529b4..3ecaa402b 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererHorizontalBarChart.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererHorizontalBarChart.kt @@ -100,7 +100,7 @@ open class YAxisRendererHorizontalBarChart( } override fun renderAxisLine(canvas: Canvas) { - if (!yAxis.isEnabled || !yAxis.isDrawAxisLineEnabled) + if (!yAxis.isEnabled || !yAxis.isDrawAxisLine) return paintAxisLine.color = yAxis.axisLineColor diff --git a/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererRadarChart.kt b/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererRadarChart.kt index fbdbc11d1..d8a60b210 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererRadarChart.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/renderer/YAxisRendererRadarChart.kt @@ -41,7 +41,7 @@ class YAxisRendererRadarChart( // If granularity is enabled, then do not allow the interval to go below specified granularity. // This is used to avoid repeated values when rounding values for display. - if (axis.isGranularityEnabled) interval = if (interval < axis.granularity) axis.granularity.toDouble() else interval + if (axis.isGranularity) interval = if (interval < axis.granularity) axis.granularity.toDouble() else interval // Normalize interval val intervalMagnitude = 10.0.pow(log10(interval).toInt().toDouble()).roundToNextSignificant().toDouble() @@ -58,7 +58,7 @@ class YAxisRendererRadarChart( var n = if (centeringEnabled) 1 else 0 // force label count - if (axis.isForceLabelsEnabled) { + if (axis.isForceLabels) { val step = range.toFloat() / (labelCount - 1).toFloat() axis.entryCount = labelCount