I have a variable number of Switch buttons. Each is associated with a size that will be graphically represented in an xChart. The user can switch one or more buttons. I want to know how I could dynamically create the necessary Array for xChart data feed. Used code is:
The ListOfValues list always contains only the values that will be displayed (if the user selects the first, second and fifth buttons, the list will contain "Moment", "v1", "v2" and "v5").
For a small number of variants can be written with Switch but if the number of variants is larger I do not think it is an elegant solution.
Thank you!
B4X:
Dim MenuItems As List
MenuItems = m.Get("ListOfValues")
For i = 0 To MenuItems.Size - 1
m = MenuItems.Get(i)
LineChart2.AddLineMultiplePoints(m.Get("Moment"), Array As Double(m.Get("v1"),...... m.Get("vX")), i Mod 90 = 0)
Next
The ListOfValues list always contains only the values that will be displayed (if the user selects the first, second and fifth buttons, the list will contain "Moment", "v1", "v2" and "v5").
For a small number of variants can be written with Switch but if the number of variants is larger I do not think it is an elegant solution.
Thank you!