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)
|
||||
humChart = findViewById(R.id.hum_chart)
|
||||
setupChart(tempChart)
|
||||
setupChart(humChart)
|
||||
setupChart(tempChart, 0f, 60f)
|
||||
setupChart(humChart, 0f, 100f)
|
||||
|
||||
tempCircle = findViewById(R.id.temp_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 {
|
||||
description.isEnabled = false
|
||||
setTouchEnabled(true)
|
||||
@ -194,8 +194,15 @@ class MainActivity : AppCompatActivity() {
|
||||
granularity = 1f
|
||||
setDrawGridLines(false)
|
||||
}
|
||||
|
||||
axisLeft.apply {
|
||||
axisMinimum = yMin
|
||||
axisMaximum = yMax
|
||||
setDrawGridLines(true)
|
||||
}
|
||||
|
||||
|
||||
axisRight.isEnabled = false
|
||||
axisLeft.setDrawGridLines(true)
|
||||
legend.isEnabled = true
|
||||
}
|
||||
}
|
||||
@ -250,7 +257,7 @@ class MainActivity : AppCompatActivity() {
|
||||
pipedOutput.write("$line\n".toByteArray())
|
||||
pipedOutput.flush()
|
||||
Log.d(tag, "Fake sent: $line")
|
||||
Thread.sleep(1000)
|
||||
Thread.sleep(10000)
|
||||
} catch (e: IOException) {
|
||||
Log.e(tag, "Fake stream write failed", e)
|
||||
break
|
||||
|
||||
Loading…
Reference in New Issue
Block a user