Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 11/07/2016
- --Last update: 11/07/2016
- --[[ Notes:
- graph.bars
- Does:
- Cria um gráfico.
- Args:
- qBars --> Tabela contendo número e texto de cada barra.
- title --> Título do gráfico
- Example:
- graph.bars(
- {
- [1] = {10,"01/01"},
- [2] = {30,"01/02"},
- [3] = {20,"01/03"},
- [4] = {50,"01/04"},
- [5] = {90,"01/05"},
- [6] = {40,"01/06"},
- [7] = {80,"01/07"},
- [8] = {5,"01/08"},
- }
- ,"Pay day")
- ]]--
- graph = {}
- graph.bars = function(qBars,title)
- local copy = {table.unpack(qBars)}
- table.sort(copy,function(a,b) return a[1]>b[1] end)
- local colors = {}
- while #colors ~= #qBars do
- local color = math.random(0xFFFFFF)
- colors[#colors + 1] = color
- end
- ui.addTextArea(0,"<B><J>"..title,nil,180,250 - copy[1][1],50*#qBars,copy[1][1] + 60,nil,nil,1,true)
- local t = "<B>"
- for i = 1,#qBars do
- t = t .. "<font color='#"..("%x"):format(colors[i]).."'> ■ "..qBars[i][2].."\n"
- ui.addTextArea(i .. "0000","<font color='#1' size='8'>"..qBars[i][1],nil,110 + 50 * i + 30,305 - (qBars[i][1]+1)*1.2,30,(qBars[i][1]+1)*1.2,colors[i],colors[i],.8,true)
- end
- ui.addTextArea(1,t,nil,5,30,150,350,nil,nil,1,true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement