Modulo:Grafico XY/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
use require("strict") instead of require("Module:No globals")
 
(6 versioni intermedie di un altro utente non mostrate)
Riga 1:
require("Module:No globalsstrict")
local getArgs = require('Module:Arguments').getArgs
local p = {}
Riga 10:
 
local clr = { "#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf" }
 
local minimo, massimo
 
-- =====================================================================
Line 35 ⟶ 33:
t = string.format("%g",math.floor(10*b[i]/d+0.5)/10)
t = t:gsub('%.',',')
if (minimo == nil or a[i]/c < minimo) then minimo = a[i]/c end
if (massimo == nil or a[i]/c > massimo) then massimo = a[i]/c end
values[i] = { nx = a[i]/c, ny = b[i]/d, num = i, txt = t }
end
Line 310 ⟶ 306:
while (args['area'..lg]) do
graph['data'][numero+2]['values'][lg] = { testo = args['area'..lg], x1 = args['area'..lg..'_x1'], x2 = args['area'..lg..'_x2'] }
if (minimo and tonumber(args['area'..lg..'_x1']) < minimo) then minimo = args['area'..lg..'_x1'] end
if (minimo and tonumber(args['area'..lg..'_x2']) < minimo) then minimo = args['area'..lg..'_x2'] end
if (massimo and tonumber(args['area'..lg..'_x1']) > massimo) then massimo = args['area'..lg..'_x1'] end
if (massimo and tonumber(args['area'..lg..'_x2']) > massimo) then massimo = args['area'..lg..'_x2'] end
 
graph['scales'][4]['range'][lg] = args['area'..lg..'_colore'] or clr[lg]
graph['scales'][1]['___domain']['fields'][numero+2*lg-1] = {data = "area",field = "x1"}
Line 322 ⟶ 313:
if args.area_legenda then graph['legends'][2]['orient'] = args.area_legenda end
 
if (args.distanzaXminimoX and tonumber(args.distanzaXminimoX)) then
if (minimo) then graph['scales'][1]['domainMin'] = { value = minimo - tonumber(args.distanzaXminimoX) } end
end
if (massimo) then graph['scales'][1]['domainMax'] = { value = massimo + tonumber(args.distanzaX) } end
if (args.massimoX and tonumber(args.massimoX)) then
if (massimo) then graph['scales'][1]['domainMax'] = { value = massimo + tonumber(args.distanzaXmassimoX) } end
end