Skip to content

Commit

Permalink
支持子图实现替换长按高亮值的默认计算方式
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyiqian committed Dec 23, 2021
1 parent 29da601 commit ed8a658
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,7 @@ class StockChart @JvmOverloads constructor(context: Context, attrs: AttributeSet
childCharts.forEach { childChart ->
val childChartX = x - childChart.view().left
val childChartY = y - childChart.view().top
tmp2FloatArray[0] = childChartX
tmp2FloatArray[1] = childChartY
childChart.mapPointsReal2Value(tmp2FloatArray)
childChart.getHighlightValue(childChartX, childChartY, tmp2FloatArray)
val valueX = tmp2FloatArray[0]
val valueY = tmp2FloatArray[1]
var highlight = highlightMap[childChart]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,10 @@ interface IChildChart {
* 点击
*/
fun onTap(event: GestureEvent)

fun getHighlightValue(highlightX: Float, highlightY: Float, highlightValue: FloatArray) {
highlightValue[0] = highlightX
highlightValue[1] = highlightY
mapPointsReal2Value(highlightValue)
}
}
4 changes: 2 additions & 2 deletions samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.android:flexbox:2.0.1'

// implementation project(':lib')
implementation 'com.github.wangyiqian:StockChart:1.0.17'
implementation project(':lib')
// implementation 'com.github.wangyiqian:StockChart:1.0.17'
}

0 comments on commit ed8a658

Please sign in to comment.