Scale number of y ticks in linegraph data fields (#150)
This commit is contained in:
parent
f35ffe52cc
commit
1727e606ee
@ -381,7 +381,7 @@ class LineGraphBuilder(val context: Context) {
|
|||||||
// Draw Left Y-axis ticks and labels
|
// Draw Left Y-axis ticks and labels
|
||||||
if (hasLeftYAxisData) {
|
if (hasLeftYAxisData) {
|
||||||
textPaint.textAlign = Align.RIGHT
|
textPaint.textAlign = Align.RIGHT
|
||||||
val numYTicks = if (gridWidth > 15) 2 else 1
|
val numYTicks = if (gridHeight > 15) (gridHeight / 10) else 1
|
||||||
if (abs(dataMaxYLeft - dataMinYLeft) > 0.0001f) {
|
if (abs(dataMaxYLeft - dataMinYLeft) > 0.0001f) {
|
||||||
for (i in 0..numYTicks) {
|
for (i in 0..numYTicks) {
|
||||||
val value = dataMinYLeft + ((dataMaxYLeft - dataMinYLeft) / numYTicks) * i
|
val value = dataMinYLeft + ((dataMaxYLeft - dataMinYLeft) / numYTicks) * i
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user