mirror of
https://github.com/dzeiocom/charts.git
synced 2025-07-29 08:19:52 +00:00
feat: Allow to switch line/points/dottedline display (#56)
This commit is contained in:
@ -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
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user