Content deleted Content added
Tom.Reding (talk | contribs) m Change default showValues.fontcolor from black to persistentGrey, from sandbox |
No edit summary |
||
Line 3:
--
-- Version History (_PLEASE UPDATE when modifying anything_):
-- 2020-05-27 Map: allow specification which feature to display and changing the map center
-- 2020-04-08 Change default showValues.fontcolor from black to persistentGrey
-- 2020-04-06 Logarithmic scale outputs wrong axis labels when "nice"=true
-- 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
Line 75 ⟶ 77:
local defaultValue = frame.args.defaultValue
local scaleType = frame.args.scaleType or "linear"
-- smallest value (only for numeric data)
local domainMin = tonumber(frame.args.domainMin)
-- largest value (only for numeric data)
local domainMax = tonumber(frame.args.domainMax)
-- color scale (only for numeric data)
-- show legend
local legend = frame.args.legend
-- the map feature to display
local feature = frame.args.feature or "countries"
-- map center
local center = numericArray(frame.args.center)
-- format JSON output
local formatJson = frame.args.formatjson
Line 172 ⟶ 178:
{
-- data source for map paths data
name =
url = basemapUrl,
format = { type = "topojson", feature =
transform =
{
Line 182 ⟶ 188:
value = "data", -- data source
scale = scale,
center = center,
projection = projection
},
Line 202 ⟶ 209:
{
type = "path",
from = { data =
properties =
{
Line 320 ⟶ 327:
local xscale =
{
type = xScaleType or "linear",
range = "width",
zero = false, -- do not include zero value
nice =
___domain = { data = "chart", field = "x" }
}
if xMin then xscale.domainMin = xMin end
if xMax then xscale.domainMax = xMax end
Line 352 ⟶ 359:
local yscale =
{
type = yScaleType or "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
zero = chartType ~= "line",
nice = yScaleType ~= "log" -- force round numbers for y scale, but log scale outputs a wrong "nice" scale
}
if yMin then yscale.domainMin = yMin end
if yMax then yscale.domainMax = yMax end
|