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 @@ -6,7 +6,7 @@ import com.github.mikephil.charting.utils.MPPointD
import kotlin.math.abs
import kotlin.math.max

open class BarHighlighter(barDataProvider: BarDataProvider?) : ChartHighlighter<BarDataProvider?>(barDataProvider) {
open class BarHighlighter(barDataProvider: BarDataProvider?) : ChartHighlighter<BarDataProvider>(barDataProvider) {
override fun getHighlight(x: Float, y: Float): Highlight? {
val high = super.getHighlight(x, y) ?: return null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import com.github.mikephil.charting.utils.MPPointD
import kotlin.math.abs
import kotlin.math.hypot

open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider?>(protected var provider: T?) : IHighlighter {
open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider>(protected var provider: T?) : IHighlighter {
/**
* buffer for storing previously highlighted values
*/
protected var mHighlightBuffer: MutableList<Highlight> = ArrayList()
protected var highlightBuffer: MutableList<Highlight> = ArrayList()

override fun getHighlight(x: Float, y: Float): Highlight? {
val pos = getValsForTouch(x, y)
Expand Down Expand Up @@ -87,7 +87,7 @@ open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider?>(protect
* @param y touch position
*/
protected open fun getHighlightsAtXValue(xVal: Float, x: Float, y: Float): MutableList<Highlight>? {
mHighlightBuffer.clear()
highlightBuffer.clear()

val data = this.data

Expand All @@ -102,11 +102,11 @@ open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider?>(protect
continue
}

mHighlightBuffer.addAll(buildHighlights(dataSet, i, xVal, DataSet.Rounding.CLOSEST))
highlightBuffer.addAll(buildHighlights(dataSet, i, xVal, DataSet.Rounding.CLOSEST))
i++
}

return mHighlightBuffer
return highlightBuffer
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider
import com.github.mikephil.charting.interfaces.dataprovider.CombinedDataProvider
import com.github.mikephil.charting.interfaces.datasets.IDataSet

open class CombinedHighlighter(dataProvider: CombinedDataProvider?, barChart: BarDataProvider) : ChartHighlighter<CombinedDataProvider?>(dataProvider), IHighlighter {
open class CombinedHighlighter(dataProvider: CombinedDataProvider?, barChart: BarDataProvider) : ChartHighlighter<CombinedDataProvider>(dataProvider), IHighlighter {
/**
* bar highlighter for supporting stacked highlighting
*/
Expand All @@ -20,7 +20,7 @@ open class CombinedHighlighter(dataProvider: CombinedDataProvider?, barChart: Ba
}

override fun getHighlightsAtXValue(xVal: Float, x: Float, y: Float): MutableList<Highlight>? {
mHighlightBuffer.clear()
highlightBuffer.clear()

val dataObjects = provider!!.combinedData!!.getAllData()

Expand All @@ -33,7 +33,7 @@ open class CombinedHighlighter(dataProvider: CombinedDataProvider?, barChart: Ba

if (high != null) {
high.dataIndex = i
mHighlightBuffer.add(high)
highlightBuffer.add(high)
}
} else {
var j = 0
Expand All @@ -50,13 +50,13 @@ open class CombinedHighlighter(dataProvider: CombinedDataProvider?, barChart: Ba
val highs = buildHighlights(dataSet, j, xVal, DataSet.Rounding.CLOSEST)
for (high in highs) {
high.dataIndex = i
mHighlightBuffer.add(high)
highlightBuffer.add(high)
}
j++
}
}
}

return mHighlightBuffer
return highlightBuffer
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface ChartInterface {
float getYChartMax();

/**
* Returns the maximum distance in scren dp a touch can be away from an entry to cause it to get highlighted.
* Returns the maximum distance in screen dp a touch can be away from an entry to cause it to get highlighted.
*/
float getMaxHighlightDistance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class CubicLineChartActivity : DemoBase(), OnSeekBarChangeListener {
sets.forEach { set ->
set?.let {
if (set.isDrawFilledEnabled)
set?.setDrawFilled(false)
set.setDrawFilled(false)
else
set?.setDrawFilled(true)
set.setDrawFilled(true)
}
}
binding.chart1.invalidate()
Expand Down
Loading