Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
26 changes: 9 additions & 17 deletions chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1058,23 +1059,20 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : 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
Expand Down Expand Up @@ -1132,11 +1130,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : 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<Runnable> = ArrayList()
protected set
Expand Down Expand Up @@ -1259,7 +1253,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP

// region accessibility
/**
*
* @return accessibility description must be created for each chart
*/
abstract val accessibilityDescription: String?
Expand All @@ -1285,8 +1278,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading