Modulo:Graph: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Moroboshi (discussione | contributi)
fix vari
Moroboshi (discussione | contributi)
un po di fix
Riga 24:
if value then
values[index] = value
colors[index] = args[color_string .. index_s] or cfg.default_colors[index] or cfg.default_color
labels[index] = args[label_string .. index_s] or 'xxx'
index = index + 1
else
Riga 31:
end
end
localif graph#values == 0 {}then
return ''
graph.name = args[cfg.localization.name] or 'grafico a torta'
}end
graph.width = args[cfg.localization['width']] or 400
local graph.data = {}
graph.height = args[cfg.localization['height']] or 400
graph. name = args[cfg.localization.name] or 'grafico a torta',
graph.data = {}
graph. width = args[cfg.localization['width']] or 400,
graph.data[1] = { name = "table"}
graph. height = args[cfg.localization['height']] or 400,
graph.data[1].values = values
data = {
graph.data[1].transform = { { type = "pie", value = "data" } }
graph.marks = {}
graph.marks[1] name = {}"table",
graph.marks[1].type values = "arc"values,
graph.marks[1].from transform = { data{ type = "tablepie", value = "data" } }
}
graph.marks[1].properties = {}
},
graph.marks[1].properties.enter = {}
graph. marks[2] = { }
graph.marks[1].properties.enter.x = { group = "width", mult = 0.5 }
{
graph.marks[1].properties.enter.y = { group = "height", mult = 0.5 }
type = "arc",
graph.marks[1].properties.enter.startAngle = {field = "startAngle"}
graph.marks[1].properties.enter.endAngle from = {field data = "endAngletable"},
graph.marks[1]. properties = {}
graph.marks[1].properties.enter.innerRadius = {value = 0}
enter = {
graph.marks[1].properties.enter.outerRadius = {value = tonumber(args[cfg.localization.radius]) or 200 }
graph.marks[1].properties.enter. x = { group = "width", mult = 0.5 },
graph.marks[1].properties.enter.stroke = {value = "#000"}
graph.marks[1].properties.enter. y = { group = "height", mult = 0.5 },
graph.marks[1].properties.update = { fill = {value = "#ccc"} }
graph.marks[1].properties.enter. startAngle = {field = "startAngle"},
graph.marks[1].properties.hover = { fill = {value = "pink"} }
endAngle = {field = "endAngle"},
graph.marks[2] = { }
graph.marks[1].properties.enter. innerRadius = {value = 0},
graph.marks[2].type = "text"
graph.marks[1].properties.enter. outerRadius = {value = tonumber(args[cfg.localization.radius]) or 200150 },
graph.marks[2].from = { data = "table"}
graph.marks[1].properties.enter. stroke = {value = "#000"}
graph.marks[2].properties = {}
},
graph.marks[2].properties.enter = {
x update = { groupfill = "width", mult{value = 0.5"#ccc"} },
y hover = { groupfill = "width", mult{value = 0.5"pink"} },
radius = { scale = {value = 200, offset = 8 }},
theta = { field = "midAngle"},
fill = { value = "#000" },{
align = { value type = "centertext" },
baseline from = { valuedata = "middletable" },
text = { field properties = "data"}{
enter = {
}
x = { group = "width", mult = 0.5 },
local json = mw.text.jsonEncode(graph, mw.text.JSON_PRETTY)
y = { group = "width", mult = 0.5 },
radius = { scale = {value = tonumber(args[cfg.localization.radius]) or 150, offset = 8 }},
theta = { field = "midAngle"},
fill = { value = "#000" },
align = { value = "center" },
baseline = { value = "middle" },
text = { field = "data"}
}
}
}
}
}
local json = mw.text.jsonEncode(graph, mw.text.JSON_PRETTY)
 
return frame:extensionTag("syntaxhighlight", json, {lang="json"}) .. frame:extensionTag( 'graph', json )
end