B4X Store

ELEVATEUI · B4A · XUI

UIMultiLineChart

Track several related trends on the same time axis.

78 modules 1,780 APIs

Charts & visualizations

What it solves

Track several related trends on the same time axis.

Animated conceptual demonstration, not an exact Android control screenshot.

25 methods12 Designer1 events

When to use this module

In an analytics screen, choose this visualization when the user needs to compare the values represented by its axes or series.

Before integrating, examine its methods, events and Designer options.

B4A integration examples

Tutorials are based on existing project examples or audited APIs. Check each example’s prerequisites; B4A compilation is not claimed.

Chart implementation from documented B4A example
Existing documentation example charts-registry.json Not B4A-compiled

Review required libraries, Designer views and input data before compiling in B4A.

' Ejemplo autocontenido para la Activity principal de B4A.
' Habilitar las bibliotecas XUI y ElevateUI.
Sub Process_Globals
    Private xui As XUI
End Sub

Sub Globals
    Private Root As B4XView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Root = xui.CreatePanel("")
    Activity.AddView(Root, 0, 0, 100%x, 100%y)
    Root.Color = 0xFFF8FAFC
    Dim chart As UIMultiLineChart
    chart.Initialize(Me, "Traffic")
    chart.AddToParent(Root, 12dip, 20dip, 100%x - 24dip, 260dip)
    Dim data As List
    data.Initialize
    data.Add(L(Array As Object(20,28,40,45)))
    data.Add(L(Array As Object(12,22,19,31)))
    chart.setData(L(Array As Object("L","M","X","J")), data)
    chart.setLegend(L(Array As Object("Web","Android")))
    chart.setColors(L(Array As Object(0xFF8B5CF6,0xFF06B6D4)))
    chart.setShowFill(False)
    chart.setShowGrid(True)
End Sub

' Convierte un array de Object en una lista B4A.
' Necesario para las firmas que aceptan List.
Private Sub L(Values() As Object) As List
    Dim Result As List
    Result.Initialize
    Result.AddAll(Values)
    Return Result
End Sub

Private Sub Traffic_MouseClicked
    Log("Se pulsó el gráfico de líneas")
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause(UserClosed As Boolean)
End Sub

Public methods reference

25 audited signatures

Public Sub Initialize (Callback As Object, EventName As String)

Prepare the instance before its other methods.

Callback As ObjectEventName As String
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)

Invoked automatically by the B4A Visual Designer; do not call manually.

Base As ObjectLbl As LabelProps As Map
Public Sub AddToParent(Parent As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)

Add this view to a parent container using the supplied bounds and options.

Parent As B4XViewLeft As IntTop As IntWidth As IntHeight As Int
Public Sub setData(PointsX As List, ValuesMulti As List)

Update data at runtime when this setting changes.

PointsX As ListValuesMulti As List
Public Sub setTitleFont(Font As B4XFont)

Update title font at runtime when this setting changes.

Font As B4XFont
Public Sub setTitleColor(Color As Int)

Update title color at runtime when this setting changes.

Color As Int
Public Sub setXAxisTextColor(Color As Int)

Update xaxis text color at runtime when this setting changes.

Color As Int
Public Sub setTextTitle(Title As String)

Update text title at runtime when this setting changes.

Title As String
Public Sub setColors(ColorsList As List)

Update colors at runtime when this setting changes.

ColorsList As List
Public Sub setShowValues(Show As Boolean)

Update show values at runtime when this setting changes.

Show As Boolean
Public Sub setShowFill(Show As Boolean)

Update show fill at runtime when this setting changes.

Show As Boolean
Public Sub setLegend(Names As List)

Update legend at runtime when this setting changes.

Names As List
Public Sub setValueSuffix(Suffix As String)

Update value suffix at runtime when this setting changes.

Suffix As String
Sub setCurves (Curves As Boolean)

Update curves at runtime when this setting changes.

Curves As Boolean
Public Sub SaveAsPNG(Dir As String, FileName As String) As Boolean

Use SaveAsPNG for its named operation; follow its exact signature.

Dir As StringFileName As String

Returns: Boolean

Public Sub setShowAxes(Show As Boolean)

Update show axes at runtime when this setting changes.

Original catalog note: Shows or hides X and Y axis lines without hiding category labels.

Show As Boolean
Public Sub getShowAxes As Boolean

Read the current show axes value for validation or UI synchronization.

Returns: Boolean

Public Sub setShowYAxisValues(Show As Boolean)

Update show yaxis values at runtime when this setting changes.

Original catalog note: Numeric Y-axis scale visibility is independent of individual data values.

Show As Boolean
Public Sub getShowYAxisValues As Boolean

Read the current show yaxis values value for validation or UI synchronization.

Returns: Boolean

Public Sub setShowGrid(Show As Boolean)

Update show grid at runtime when this setting changes.

Show As Boolean
Public Sub getShowGrid As Boolean

Read the current show grid value for validation or UI synchronization.

Returns: Boolean

Public Sub setGridColor(Color As Int)

Update grid color at runtime when this setting changes.

Color As Int
Public Sub getGridColor As Int

Read the current grid color value for validation or UI synchronization.

Returns: Int

Public Sub setGridInterval(Interval As Float)

Update grid interval at runtime when this setting changes.

Interval As Float
Public Sub getGridInterval As Float

Read the current grid interval value for validation or UI synchronization.

Returns: Float

Designer · 12

#DesignerProperty: Key: LineColors, DisplayName: Line Colors, FieldType: String, DefaultValue: #FF6C5CE7;#FF00CEC9;#FF55EFC4;#FFFDCB6E;#FFD63031;#FF0984E3;#FFFAB1A0;#FF74B9FF;#FFA29BFE;#FF81ECEC, Description: Colors of the lines (separated by semicolons, format #AARRGGBB)#DesignerProperty: Key: ShowMarker, DisplayName: Show Point Values, FieldType: Boolean, DefaultValue: True, Description: Shows the values above each point#DesignerProperty: Key: MarkerText, DisplayName: Title Text, FieldType: String, DefaultValue: API Calls#DesignerProperty: Key: Animate, DisplayName: Animate, FieldType: Boolean, DefaultValue: True#DesignerProperty: Key: Duration, DisplayName: Animation Duration, FieldType: Int, DefaultValue: 1000, Description: Duration in milliseconds#DesignerProperty: Key: SeriesNames, DisplayName: Series Names, FieldType: String, DefaultValue: Serie1;Serie2;Serie3;Serie4;Serie5;Serie6;Serie7;Serie8;Serie9;Serie10, Description: Names of the series#DesignerProperty: Key: ShowFill, DisplayName: Show Fill, FieldType: Boolean, DefaultValue: True, Description: Shows or hides the fill under the chart lines#DesignerProperty: Key: ValueSuffix, DisplayName: Value Suffix, FieldType: String, DefaultValue: , Description: Suffix for point values (e.g., %, $, etc.)#DesignerProperty: Key: SmoothCurves, DisplayName: Smooth Curves, FieldType: Boolean, DefaultValue: False, Description: Use cubic bezier curves instead of straight lines.#DesignerProperty: Key: ShowGrid, DisplayName: Show Grid, FieldType: Boolean, DefaultValue: False, Description: Shows or hides the horizontal grid lines#DesignerProperty: Key: GridColor, DisplayName: Grid Color, FieldType: Color, DefaultValue: 0xFF64748B, Description: Color of the horizontal grid lines#DesignerProperty: Key: GridInterval, DisplayName: Grid Interval, FieldType: Float, DefaultValue: 0, Description: Step interval value for grid lines (e.g. 100, 1000). Set to 0 for automatic division.

Public events and how to implement them · 1

Initialize with Me and the event prefix Demo, then add the following handler to your B4A module. Names and arguments come from the library declaration.

MouseClicked

Raised when the user taps the control; use it to trigger a real action.

B4A handler signature with Demo prefix

Private Sub Demo_MouseClicked()
    Log("MouseClicked")
End Sub

For code-created controls use Initialize(Me, "Demo") when that signature exists; for Designer controls set the event name there. Replace Demo with the actual prefix.

Public fields, constants and types

Public mBase As B4XView
Source: ElevateUI public API catalog; tutorials cross-checked against ElevateUI(6).b4xlib. Visualizations are illustrative; sample code requires B4A compilation.