Skip to content

Commit

Permalink
v0.9.2 data scale fix for less than a minute
Browse files Browse the repository at this point in the history
  • Loading branch information
ellsworthrw committed Jun 10, 2022
1 parent b8f4487 commit 7445a1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tasks {
}

extra["artifactID"] = "charts-android"
extra["artifactVersion"] = "0.9.1"
extra["artifactVersion"] = "0.9.2"
extra["libraryName"] = "Diamond Charts"
extra["libraryDescription"] = "Diamond Charts: charting library for Android Jetpack Compose"
extra["gitUrl"] = "https://github.com/ellsworthrw/DiamondCharts"
Expand Down
20 changes: 13 additions & 7 deletions charts/src/main/java/com/diamondedge/charts/DateAxis.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,19 @@ class DateAxis : Axis() {
log.v { "> 1m inc: 1m" }
majorTickInc = DateUtil.ONE_MINUTE
tickLabelDateFormat = hourMinuteFormat
minorTickIncNum = 2
minorTickIncNum = 6
}
range > 9 * DateUtil.ONE_SECOND -> {
log.v { "> 9s inc: 5s" }
majorTickInc = 5 * DateUtil.ONE_SECOND
tickLabelDateFormat = hourMinuteFormat
minorTickIncNum = 5
range > 30 * DateUtil.ONE_SECOND -> {
log.v { "> 30s inc: 20s" }
majorTickInc = 20 * DateUtil.ONE_SECOND
tickLabelDateFormat = hourMinuteSecondFormat
minorTickIncNum = 4
}
range > 2 * DateUtil.ONE_SECOND -> {
log.v { "> 2s inc: 10s" }
majorTickInc = 10 * DateUtil.ONE_SECOND
tickLabelDateFormat = hourMinuteSecondFormat
minorTickIncNum = 2
}
else -> {
log.v { "inc: 1s" }
Expand Down Expand Up @@ -182,7 +188,7 @@ class DateAxis : Axis() {
private val minorDayFormat = SimpleDateFormat("d")
private val hourFormat = SimpleDateFormat("ha")
private val hourMinuteFormat = SimpleDateFormat("h:mma")
private val minuteFormat = SimpleDateFormat("m")
private val hourMinuteSecondFormat = SimpleDateFormat("h:mm:ssa")
private val secondFormat = SimpleDateFormat("s")
}
}

0 comments on commit 7445a1e

Please sign in to comment.