feat: Basic idea is present

This commit is contained in:
2023-02-16 17:09:29 +01:00
committed by Avior
parent e1946e98d0
commit 3965ac2f81
14 changed files with 413 additions and 253 deletions

View File

@ -125,7 +125,7 @@ class ChartFragment : Fragment() {
binding.sliderXAxisScroll.visibility = View.VISIBLE
} else {
chart.xAxis.dataWidth = null
chart.xAxis.x = 0.0
chart.xAxis.setCurrentMin(0.0)
binding.sliderXAxisScroll.visibility = View.GONE
}
chart.refresh()

View File

@ -72,6 +72,11 @@ class MainFragment : Fragment() {
LineSerie(this).apply {
entries = Utils.generateRandomDataset(5)
}
this.xAxis.keepGlobalLimits = true
this.xAxis.zoomEnabled = true
this.xAxis.scrollEnabled = true
this.yAxis.zoomEnabled = true
this.yAxis.scrollEnabled = true
MaterialUtils.materielTheme(this, requireView())
}

View File

@ -9,7 +9,7 @@ import com.google.android.material.color.MaterialColors
object MaterialUtils {
fun materielTheme(chart: ChartViewInterface, view: View) {
chart.yAxis.apply {
textLabel.color =
textPaint.color =
MaterialColors.getColor(view, com.google.android.material.R.attr.colorOnPrimaryContainer)
linePaint.color =
MaterialColors.getColor(view, com.google.android.material.R.attr.colorOnPrimaryContainer)
@ -17,8 +17,13 @@ object MaterialUtils {
MaterialColors.getColor(view, com.google.android.material.R.attr.colorError)
}
chart.xAxis.textPaint.color =
MaterialColors.getColor(view, com.google.android.material.R.attr.colorOnPrimaryContainer)
chart.xAxis.apply {
textPaint.color =
MaterialColors.getColor(view, com.google.android.material.R.attr.colorOnPrimaryContainer)
linePaint.color =
MaterialColors.getColor(view, com.google.android.material.R.attr.colorOnPrimaryContainer)
}
chart.annotator.apply {
backgroundPaint.color = MaterialColors.getColor(
view,

View File

@ -32,7 +32,7 @@
<com.dzeio.charts.ChartView
android:id="@+id/linechart"
android:layout_width="match_parent"
android:layout_height="100dp" />
android:layout_height="500dp" />
<Button
android:layout_width="match_parent"