Skip to content

Commit

Permalink
增加背景网格线配置项
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyiqian committed Jun 2, 2022
1 parent 99873f8 commit 9fe11ed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const val DEFAULT_GRID_HORIZONTAL_LINE_COUNT = 0
const val DEFAULT_GRID_VERTICAL_LINE_COUNT = 0
val DEFAULT_GRID_LINE_COLOR = Color.parseColor("#676767")
const val DEFAULT_GRID_LINE_STROKE_WIDTH = 1f
const val DEFAULT_HORIZONTAL_GRID_LINE_LEFT_OFFSET = 0f
const val DEFAULT_VALUE_TEND_TO_ZERO = 0.0001f

// K线图
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class StockChart @JvmOverloads constructor(context: Context, attrs: AttributeSet

for (i in 1..config.gridHorizontalLineCount) {
canvas.drawLine(
config.horizontalGridLineLeftOffset,
config.horizontalGridLineLeftOffsetCalculator?.invoke(this)?:0f,
top,
width.toFloat(),
top,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class StockChartConfig {
var horizontalGridLineTopOffsetCalculator: ((StockChart) -> Float)? = null

// 背景网格横线左侧偏移量
var horizontalGridLineLeftOffset: Float = DEFAULT_HORIZONTAL_GRID_LINE_LEFT_OFFSET
var horizontalGridLineLeftOffsetCalculator: ((StockChart) -> Float)? = null

// 背景网格横线间距
var horizontalGridLineSpaceCalculator: ((StockChart) -> Float)? = null
Expand Down
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.1.3'
implementation project(':lib')
// implementation 'com.github.wangyiqian:StockChart:1.1.3'
}

0 comments on commit 9fe11ed

Please sign in to comment.