Modulo:Graph: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Upgrade Pi's syntax to Vega 2.0 |
Revet back the change due to current Pie chart syntax error Etichetta: Ripristino manuale |
||
Riga 216:
end
local graph = {
version =
name = args.name,
width = math.floor(args.graphwidth / 3),
Riga 224:
name = "table",
values = data,
transform = { { type = "pie", value = "data.x" } }
}
},
Riga 233:
properties = {
enter = {
x = { field = "data.x", group = "width", mult = 0.5 },
y = { field = "data.x", group = "height", mult = 0.5 },
startAngle = { field = "
endAngle = {field = "
innerRadius = {value = args.inner_radius},
outerRadius = {value = args.outer_radius },
stroke = {value = "#fff"},
},
hover = { fill = {value = "pink"} }
},
Riga 355:
stats =
{
name = "
{
{ type = "facet",
{ type = "
}
}
Riga 370:
zero = false, -- do not include zero value
nice = true, -- force round numbers for y scale
___domain = { data = "chart", field = "data.x" }
}
if args.xMin then xscale.domainMin = args.xMin end
Riga 390:
if args.yMin or args.yMax then yscale.clamp = true end
if args.is_stacked then
yscale.___domain = { data = "
else
yscale.___domain = { data = "chart", field = "data.y" }
end
-- Color scale
Riga 404:
local groupScale
if args.graph_type == "rect" and not args.is_stacked and #args.y > 1 then
groupScale = { name = "series", type = "ordinal", range = "width", ___domain = { field = "data.series" } }
xscale.padding = 0.2 -- pad each bar group
end
Riga 421:
enter =
{
x = { scale = "x", field = "data.x" },
y = { scale = "y", field = "data.y" },
},
Riga 455:
if not args.is_stacked and #args.y > 1 then
marks.properties.enter.x.scale = "series"
marks.properties.enter.x.field = "data.series"
marks.properties.enter.width.scale = "series"
end
Riga 472:
enter =
{
x = { scale = "x", field = "data.x" },
y = { scale = "y", field = "data.y" },
shape = { scale = "symbols" },
},
Riga 487:
-- if there are multiple series, connect colors to series
if args.graph_type == "rect" and args.colorsByGroup then
marks.properties.update[colorField].field = "data.x"
else
marks.properties.update[colorField].field = "data.series"
end
if symbolsScale then
symbolsMarks.properties.enter.shape.field = "data.series"
symbolsMarks.properties.update.stroke.field = "data.series"
end
if alphaScale then marks.properties.update[colorField .. "Opacity"].field = "data.series" end
-- apply a grouping (facetting) transformation
Riga 509:
{
type = "facet",
}
}
Riga 516:
-- for stacked charts apply a stacking transformation
if args.is_stacked then
marks.from.transform[2] = { type = "stack", point = "data.x", height = "data.y" }
else
-- for bar charts the series are side-by-side grouped by x
if args.graph_type == "rect" then
marks.from.transform[1].
marks.scales = { groupScale }
marks.properties = { enter = { x = { field = "key", scale = "x" }, width = { scale = "x", band = true } } }
Riga 540:
local output =
{
version =
width = args.graphwidth,
height = args.graphheight,
|