• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua A bar graph

lexus21

Active Member
Joined
Dec 14, 2022
Messages
87
Reaction score
25
I would like to make a chart with 30 bars side by side. Each bar with a width of say 2px and a value 20px I have the following code:
Lua:
function initBars()
  local VisualizationContainer = VWindow:recursiveGetChildById('VisualizationContainer')
  for i = 1, 30 do
    local bar = g_ui.createWidget('UIWidget', VisualizationContainer)
    bar:setBackgroundColor('#CC99FF')
    bar:setHeight(20)
    bar:setWidth(2) 
    table.insert(bars, bar)
  end
end

and otui:

Code:
MiniWindow
  id: VWindow
  !text: tr('Chart')
  height: 190
  icon: /images/topButtons/inventory
  @onClose: modules.game_chart.onMiniWindowClose()
  &save: true
  &autoOpen: 11

  MiniWindowContents
    padding-left: 5
    padding-right: 5
    layout: verticalBox
     
    UIWidget
      id: VisualizationContainer
      height: 100
      margin-top: 5
      background-color: #FFFF00

1707760369390.png

only one bar is shown on the chart.

I'm using otcv8.

Question: How can I make 30 bars side by side on a chart?
 
Back
Top