diff --git a/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt b/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt index f2d7cc2fe..30eca4676 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt @@ -49,6 +49,7 @@ class CombinedChartActivity : DemoBase() { binding.chart1.setDrawGridBackground(false) binding.chart1.isDrawBarShadow = false binding.chart1.isHighlightFullBar = false + binding.chart1.isLogging = true // draw bars behind lines binding.chart1.drawOrder = mutableListOf( diff --git a/chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt b/chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt index 6068d176c..d69018bdc 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt @@ -15,6 +15,7 @@ import android.util.AttributeSet import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent +import androidx.core.graphics.createBitmap import info.appdev.charting.animation.ChartAnimator import info.appdev.charting.animation.Easing.EasingFunction import info.appdev.charting.components.Description @@ -1058,23 +1059,20 @@ abstract class Chart>> : ViewGroup, IBaseP */ get() = this.center + /** + * Returns the bitmap that represents the chart. + */ val chartBitmap: Bitmap - /** - * Returns the bitmap that represents the chart. - */ get() { // Define a bitmap with the same size as the view - val returnedBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565) + val returnedBitmap = createBitmap(width, height, Bitmap.Config.RGB_565) // Bind a canvas to it val canvas = Canvas(returnedBitmap) // Get the view's background val bgDrawable = background - if (bgDrawable != null) // has background drawable, then draw it on the canvas - { + if (bgDrawable != null) { // has background drawable, then draw it on the canvas bgDrawable.draw(canvas) - } else // does not have background drawable, then draw white background on - // the canvas - { + } else { // does not have background drawable, then draw white background on the canvas canvas.drawColor(Color.WHITE) } // draw the view on the canvas @@ -1132,11 +1130,7 @@ abstract class Chart>> : ViewGroup, IBaseP } /** - * Returns all jobs that are scheduled to be executed after - * onSizeChanged(...). - */ - /** - * tasks to be done after the view is setup + * Returns all jobs that are scheduled to be executed after onSizeChanged(...). */ var jobs: ArrayList = ArrayList() protected set @@ -1259,7 +1253,6 @@ abstract class Chart>> : ViewGroup, IBaseP // region accessibility /** - * * @return accessibility description must be created for each chart */ abstract val accessibilityDescription: String? @@ -1285,8 +1278,7 @@ abstract class Chart>> : ViewGroup, IBaseP const val PAINT_GRID_BACKGROUND: Int = 4 /** - * paint for the info text that is displayed when there are no values in the - * chart + * paint for the info text that is displayed when there are no values in the 3chart */ const val PAINT_INFO: Int = 7 diff --git a/chartLib/src/main/kotlin/info/appdev/charting/highlight/Highlight.kt b/chartLib/src/main/kotlin/info/appdev/charting/highlight/Highlight.kt index 8822ab99d..5f04f0ea1 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/highlight/Highlight.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/highlight/Highlight.kt @@ -144,6 +144,6 @@ class Highlight : Serializable { } override fun toString(): String { - return "Highlight, x:$x y:$y dataSetIndex:$dataSetIndex stackIndex (only stacked bar entry): $stackIndex" + return "Highlight, x:$x y:$y dataSetIndex:$dataSetIndex stackIndex:$stackIndex (only stacked bar entry)" } } 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 8c135f14f..52684d5e8 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt @@ -533,8 +533,8 @@ class BarLineChartTouchListener( return false } - val h = chart.getHighlightByTouchPoint(e.x, e.y) - performHighlight(h) + val highlight = chart.getHighlightByTouchPoint(e.x, e.y) + performHighlight(highlight) return super.onSingleTapUp(e) }