ผลต่างระหว่างรุ่นของ "มอดูล:Graph"

เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
หน้าใหม่: -- ATTENTION: Please edit this code at https://de.wikipedia.org/wiki/Modul:Graph -- This way all wiki languages can stay in sync. Thank you! -- -- Version H...
 
update for log
บรรทัด 3:
--
-- Version History (_PLEASE UPDATE when modifying anything_):
-- 2020-03-11 Allow user-defined scale types, e.g. logarithmic scale
-- 2019-11-08 Apply color-inversion-friendliness to legend title, labels, and xGrid
-- 2019-01-24 Allow comma-separated lists to contain values with commas
เส้น 65 ⟶ 66:
function p.map(frame)
-- map path data for geographic objects
local basemap = frame.args.basemap or "Template:Graph:Map/Inner/Worldmap2c-json" -- de uses "WorldMap-iso2.json" inname Module:Graphand/or location may vary from wiki to wiki
-- scaling factor
local scale = tonumber(frame.args.scale) or 100
เส้น 313 ⟶ 314:
end
 
local function getXScale(chartType, stacked, xMin, xMax, xType, xScaleType)
if chartType == "pie" then return end
 
เส้น 319 ⟶ 320:
{
name = "x",
type = "linear",
range = "width",
zero = false, -- do not include zero value
บรรทัด 325:
domain = { data = "chart", field = "x" }
}
if xScaleType then xscale.type = xScaleType else xscale.type = "linear" end
if xMin then xscale.domainMin = xMin end
if xMax then xscale.domainMax = xMax end
เส้น 345 ⟶ 346:
end
 
local function getYScale(chartType, stacked, yMin, yMax, yType, yScaleType)
if chartType == "pie" then return end
 
เส้น 351 ⟶ 352:
{
name = "y",
type = "linear",
range = "height",
-- area charts have the lower boundary of their filling at y=0 (see marks.properties.enter.y2), therefore these need to start at zero
บรรทัด 357:
nice = true
}
if yScaleType then yscale.type = yScaleType else yscale.type = "linear" end
if yMin then yscale.domainMin = yMin end
if yMax then yscale.domainMax = yMax end
เส้น 842 ⟶ 843:
local yAxisFormat = frame.args.yAxisFormat
local xAxisAngle = tonumber(frame.args.xAxisAngle)
-- x and y scale types
local xScaleType = frame.args.xScaleType
local yScaleType = frame.args.yScaleType
-- show grid
local xGrid = frame.args.xGrid or "0"
เส้น 910 ⟶ 914:
local scales = {}
 
local xscale = getXScale(chartType, stacked, xMin, xMax, xType, xScaleType)
table.insert(scales, xscale)
local yscale = getYScale(chartType, stacked, yMin, yMax, yType, yScaleType)
table.insert(scales, yscale)