B4J Question Barc Chart question

micro

Well-Known Member
Licensed User
Longtime User
Hi
I have a small problem, following a trial on the use of barchart:
B4X:
Sub Setbar
Dim cvs As Canvas
    cvs.Initialize("")
    grafpan.AddNode(cvs, 180, 4, 693, 508)
    Dim BD As BarData
    BD.Initialize
    BD.BarsWidth = 8dip
    BD.Canvas = cvs
    BD.Stacked = False
    Dim l As List
    l.Initialize
    l.AddAll(Array As Int(94, 97, 82, 87, 100, 110, 50, 140, 100, 67, 48, 180, 20, 400))
    l.Sort(False)
    For i = 0 To l.Size - 1
        Charts.AddBarColor(BD, MakeTransparent(fx.Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255)), 230)) '???
    Next
    For i = 0 To l.Size - 1
        Charts.AddBarPoint(BD, Rnd(1, 50) , Array As Float(l.Get(i)))
    Next
    Dim G As Graph
    G.Initialize
    G.Title = "Rappresentazione Varie"
    G.XAxis = "Identificativo"
    G.YAxis = "Varie"
    G.YStart = 0
    G.YEnd = l.Get(0)
    G.YInterval = 10
    G.AxisColor = fx.Colors.Black
    Charts.DrawBarsChart(G, BD, fx.Colors.RGB(220, 220, 220))
End Sub

Why con this code the Bars color is always the same??
B4X:
For i = 0 To l.Size - 1
        Charts.AddBarColor(BD, MakeTransparent(fx.Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255)), 230)) '???
    Next
 
Top