Modulo:Grafico XY: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
Nessun oggetto della modifica
Riga 44:
data = {
{
name = "tabletab",
transform = { { type = "sort", by = "nx" } },
values = { }
},
{
name = "table2tab2",
transform = { { type = "sort", by = "nx" } },
values = { }
},
{
name = "tab3",
transform = { { type = "sort", by = "nx" } },
values = { }
Riga 60 ⟶ 65:
range = "width",
zero = false,
___domain = {fields = {{data = "tabletab",field = "nx"}, {data = "table2tab2",field = "nx"}, {data = "tab3",field = "nx"}}}
},
{
Riga 68 ⟶ 73:
zero = true,
nice = true,
___domain = {fields = {{data = "tabletab",field = "ny"}, {data = "table2tab2",field = "ny"}, {data = "tab3",field = "ny"}}}
}
},
Riga 91 ⟶ 96:
{
type = "line",
from = {data = "tabletab" },
properties = {
enter = {
Riga 105 ⟶ 110:
{
type = "line",
from = {data = "table2tab2" },
properties = {
enter = {
Riga 112 ⟶ 117:
y = {scale = "y",field = "ny"},
stroke = {value = "#b80000"},
strokeWidth = {value = 4},
opacity = {value = 0.5}
}
}
},
{
type = "line",
from = {data = "tab3" },
properties = {
enter = {
interpolate = {value = "linear"},
x = {scale = "x",field = "nx"},
y = {scale = "y",field = "ny"},
stroke = {value = "#00c000"},
strokeWidth = {value = 4},
opacity = {value = 0.5}
Riga 119 ⟶ 138:
{
type = "symbol",
from = {data = "tabletab"},
properties = {
enter = {
Riga 132 ⟶ 151:
{
type = "symbol",
from = {data = "table2tab2"},
properties = {
enter = {
Riga 139 ⟶ 158:
stroke = {value = "#b80000"},
fill = {value = "#fff"},
size = {value = 1830}
}
}
},
{
type = "symbol",
from = {data = "tab3"},
properties = {
enter = {
x = {scale = "x",field = "nx"},
y = {scale = "y",field = "ny"},
stroke = {value = "#00c000"},
fill = {value = "#fff"},
size = {value = 30}
}
}
Riga 145 ⟶ 177:
{
type = "text",
from = { data = "tabletab" },
properties = {
enter = {
Riga 158 ⟶ 190:
{
type = "text",
from = { data = "table2tab2" },
properties = {
enter = {
x = {scale = "x",field = "nx"},
y = {scale = "y",field = "ny", offset = -6},
align = {value = "center"},
fill = {value = "#000"},
text = {field = "ny" }
}
}
},
{
type = "text",
from = { data = "tab3" },
properties = {
enter = {
Riga 171 ⟶ 216:
}
}
-- titoli assi
local titoloX = args.titoloX or 'X'
local fattoreX = args.fattoreX and tonumber(args.fattoreX) and tonumber(args.fattoreX) or 1
Riga 191 ⟶ 237:
end
graph['axes'][2]['title'] = titoloY
if (args.zeroX and args.zeroX == 's') then
graph['scales'][1]['zero'] = true
end
if (args.zeroY and args.zeroY == 'n') then graph['scales'][2]['zero'] = false end
 
-- zero su assi
if (args.zeroX and args.zeroX == 's') then graph['scales'][1]['zero'] = true end
if (args.zeroY and args.zeroY == 'n') then graph['scales'][2]['zero'] = false end
-- legge valori
local dx1 = leggi(args, "x1")
local dy1 = leggi(args, "y1")
local dx2 = leggi(args, "x2")
local dy2 = leggi(args, "y2")
local dx3 = leggi(args, "x3")
local dy3 = leggi(args, "y3")
graph['data'][1]['values'] = unisci(dx1, dy1, fattoreX, fattoreY)
graph['data'][2]['values'] = unisci(dx2, dy2, fattoreX, fattoreY)
graph['data'][3]['values'] = unisci(dx3, dy3, fattoreX, fattoreY)
-- dimensioni
graph['width'] = args.dimx and tonumber(args.dimx) and tonumber(args.dimx) or 350
graph['height'] = args.dimy and tonumber(args.dimy) and tonumber(args.dimy) or 250
-- colori
 
if args.colore1 then
graph['marks'][1]['properties']['enter']['stroke']['value'] = args.colore1
graph['marks'][4]['properties']['enter']['stroke']['value'] = args.colore1
end
if args.colore2 then
graph['marks'][2]['properties']['enter']['stroke']['value'] = args.colore2
graph['marks'][5]['properties']['enter']['stroke']['value'] = args.colore2
end
if args.colore3 then
graph['marks'][3]['properties']['enter']['stroke']['value'] = args.colore3
graph['marks'][6]['properties']['enter']['stroke']['value'] = args.colore3
end
-- opzioni etichette
if args.etichette1 then
if args.etichette1 == 'dispari' then
graph['marks'][57]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 1)"}}
elseif args.etichette1 == 'pari' then
graph['marks'][57]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 0)"}}
elseif args.etichette1 == 'no' then
graph['marks'][57]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
end
end
if args.tipo1mostra1 then
if args.tipo1mostra1 == '1' then
graph['marks'][34]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
elseif args.tipo1mostra1 == '2' then
graph['marks'][1]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
end
Riga 224 ⟶ 286:
if args.etichette2 then
if args.etichette2 == 'dispari' then
graph['marks'][68]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 1)"}}
elseif args.etichette2 == 'pari' then
graph['marks'][68]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 0)"}}
elseif args.etichette2 == 'no' then
graph['marks'][68]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
end
end
if args.tipo2 then
if args.tipo2mostra2 == '1' then
graph['marks'][45]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
elseif args.tipo2mostra2 == '2' then
graph['marks'][2]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
end
end
if args.etichette3 then
if args.etichette3 == 'dispari' then
graph['marks'][9]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 1)"}}
elseif args.etichette3 == 'pari' then
graph['marks'][9]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 0)"}}
elseif args.etichette3 == 'no' then
graph['marks'][9]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
end
end
if args.tipo3 then
if args.mostra3 == '1' then
graph['marks'][6]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
elseif args.mostra3 == '2' then
graph['marks'][3]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
end
end