feat: Allow to switch line/points/dottedline display (#56)

This commit is contained in:
2023-02-28 16:47:39 +01:00
committed by GitHub
parent 6ab36e9ade
commit e1946e98d0
4 changed files with 84 additions and 4 deletions

View File

@ -138,6 +138,23 @@ class ChartFragment : Fragment() {
chart.refresh()
}
}
if (args.chartType === "linechart") {
binding.lineItem.visibility = View.VISIBLE
binding.lineDisplayLines.setOnCheckedChangeListener { _, isChecked ->
chart.series.forEach { (it as LineSerie).displayLines = isChecked }
chart.refresh()
}
binding.lineDisplayPoints.setOnCheckedChangeListener { _, isChecked ->
chart.series.forEach { (it as LineSerie).displayPoints = isChecked }
chart.refresh()
}
binding.lineDotted.setOnCheckedChangeListener { _, isChecked ->
chart.series.forEach { (it as LineSerie).dotted = isChecked }
chart.refresh()
}
}
}
private var lastGenerated = 0

View File

@ -209,6 +209,36 @@
</LinearLayout>
<LinearLayout
android:id="@+id/line_item"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/line_dotted"
android:text="Switch Dotted line"
android:checked="false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/line_display_points"
android:text="Display points"
android:checked="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/line_display_lines"
android:text="Display lines"
android:checked="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>