Set the scale of the graph to an hardcoded value instead of a dynamic one
This commit is contained in:
parent
26055a8e38
commit
3080005928
@ -62,8 +62,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
tempChart = findViewById(R.id.temp_chart)
|
tempChart = findViewById(R.id.temp_chart)
|
||||||
humChart = findViewById(R.id.hum_chart)
|
humChart = findViewById(R.id.hum_chart)
|
||||||
setupChart(tempChart)
|
setupChart(tempChart, 0f, 60f)
|
||||||
setupChart(humChart)
|
setupChart(humChart, 0f, 100f)
|
||||||
|
|
||||||
tempCircle = findViewById(R.id.temp_circle)
|
tempCircle = findViewById(R.id.temp_circle)
|
||||||
humCircle = findViewById(R.id.hum_circle)
|
humCircle = findViewById(R.id.hum_circle)
|
||||||
@ -173,7 +173,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupChart(chart: LineChart) {
|
private fun setupChart(chart: LineChart, yMin: Float, yMax: Float) {
|
||||||
chart.apply {
|
chart.apply {
|
||||||
description.isEnabled = false
|
description.isEnabled = false
|
||||||
setTouchEnabled(true)
|
setTouchEnabled(true)
|
||||||
@ -194,8 +194,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
granularity = 1f
|
granularity = 1f
|
||||||
setDrawGridLines(false)
|
setDrawGridLines(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
axisLeft.apply {
|
||||||
|
axisMinimum = yMin
|
||||||
|
axisMaximum = yMax
|
||||||
|
setDrawGridLines(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
axisRight.isEnabled = false
|
axisRight.isEnabled = false
|
||||||
axisLeft.setDrawGridLines(true)
|
|
||||||
legend.isEnabled = true
|
legend.isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +257,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
pipedOutput.write("$line\n".toByteArray())
|
pipedOutput.write("$line\n".toByteArray())
|
||||||
pipedOutput.flush()
|
pipedOutput.flush()
|
||||||
Log.d(tag, "Fake sent: $line")
|
Log.d(tag, "Fake sent: $line")
|
||||||
Thread.sleep(1000)
|
Thread.sleep(10000)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.e(tag, "Fake stream write failed", e)
|
Log.e(tag, "Fake stream write failed", e)
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user