Difference between revisions of "Template:COVID-19 pandemic interactive maps/India"
Jump to navigation
Jump to search
imported>Timbaaa (param domain-upper-value default removed) |
imported>Timbaaa (Syncing from sandbox) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
− | <div id ="interactive-covid-19-india-map" style=" | + | <div id ="interactive-covid-19-india-map" style="margin: 8px;"> |
{{#tag:graph | {{#tag:graph | ||
|{ | |{ | ||
Line 9: | Line 9: | ||
"background": "#edf1f7", | "background": "#edf1f7", | ||
"data": [ | "data": [ | ||
+ | { | ||
+ | "name": "population", | ||
+ | "url": "wikiraw://en.wikipedia.org/Template:COVID-19 pandemic interactive maps/India/Population by region", | ||
+ | "format": { | ||
+ | "type": "csv" | ||
+ | } | ||
+ | }, | ||
{ | { | ||
"name": "highlights", | "name": "highlights", | ||
Line 19: | Line 26: | ||
}, | }, | ||
"transform": [ | "transform": [ | ||
+ | {{#if: {{{per-capita|}}} | ||
+ | | { | ||
+ | "type": "lookup", | ||
+ | "on": "population", | ||
+ | "keys": ["id"], | ||
+ | "onKey": "id", | ||
+ | "as": ["population"], | ||
+ | "default": {} | ||
+ | }, | ||
{ | { | ||
+ | "type": "formula", | ||
+ | "field": "v", | ||
+ | "expr": "round((parseFloat(datum[''+dateStamp])/datum.population.Population)*{{{per-capita}}})" | ||
+ | } | ||
+ | | { | ||
"type": "formula", | "type": "formula", | ||
"field": "v", | "field": "v", | ||
"expr": "parseFloat(datum[''+dateStamp])" | "expr": "parseFloat(datum[''+dateStamp])" | ||
} | } | ||
− | ] | + | }} ] |
+ | |||
}, | }, | ||
{ | { | ||
Line 45: | Line 67: | ||
"type": "geopath", | "type": "geopath", | ||
"value": "data", | "value": "data", | ||
− | "scale": 820, | + | "scale": {{#expr:{{{scale|1}}}*820}}, |
"center": [65,40], | "center": [65,40], | ||
"translate": [0,0], | "translate": [0,0], | ||
Line 143: | Line 165: | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {"value": 10}, | + | "x": {"value": {{#expr:{{{scale|1}}}*10}}}, |
− | "y": {"value": 10}, | + | "y": {"value": {{#expr:{{{scale|1}}}*10}}}, |
− | "fontSize": {"value": 16}, | + | "fontSize": {"value": {{#expr:{{{scale|1}}}*16}}}, |
"fill": {"value": "black"} | "fill": {"value": "black"} | ||
}, | }, | ||
Line 156: | Line 178: | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {"value": 10}, | + | "x": {"value": {{#expr:{{{scale|1}}}*10}}}, |
− | "y": {"value": 30}, | + | "y": {"value": {{#expr:{{{scale|1}}}*30}}}, |
− | "fontSize": {"value": 16}, | + | "fontSize": {"value": {{#expr:{{{scale|1}}}*16}}}, |
"fill": {"value": "black"} | "fill": {"value": "black"} | ||
}, | }, | ||
Line 192: | Line 214: | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {"value": 0}, | + | "x": {"value": {{#expr:{{{scale|1}}}*0}}}, |
− | "y": {"value": 40}, | + | "y": {"value": {{#expr:{{{scale|1}}}*40}}}, |
"x2": {"value": {{#expr:{{{scale|1}}}*500}} }, | "x2": {"value": {{#expr:{{{scale|1}}}*500}} }, | ||
"stroke": {"value": "#edf1f7"}, | "stroke": {"value": "#edf1f7"}, | ||
− | "strokeWidth": {"value": 16} | + | "strokeWidth": {"value": {{#expr:{{{scale|1}}}*16}}} |
} | } | ||
} | } | ||
Line 205: | Line 227: | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {"value": 0}, | + | "x": {"value": {{#expr:{{{scale|1}}}*0}}}, |
− | "y": {"value": 40}, | + | "y": {"value": {{#expr:{{{scale|1}}}*40}}}, |
"x2": {"value": {{#expr:{{{scale|1}}}*500}}}, | "x2": {"value": {{#expr:{{{scale|1}}}*500}}}, | ||
"stroke": {"value": "#000"}, | "stroke": {"value": "#000"}, | ||
Line 218: | Line 240: | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {"value": 200}, | + | "x": {"value": {{#expr:{{{scale|1}}}*200}}}, |
− | "y": {"value": 40}, | + | "y": {"value": {{#expr:{{{scale|1}}}*40}}}, |
− | "size": {"value": 154}, | + | "size": {"value": {{#expr:{{{scale|1}}}*154}}}, |
"stroke": {"value": "#880"}, | "stroke": {"value": "#880"}, | ||
− | "strokeWidth": {"value": 2.5} | + | "strokeWidth": {"value": {{#expr:{{{scale|1}}}*2.5}}} |
}, | }, | ||
"update": { | "update": { | ||
Line 237: | Line 259: | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {"value": 300}, | + | "x": {"value": {{#expr:{{{scale|1}}}*300}}}, |
− | "y": {"value": 30}, | + | "y": {"value": {{#expr:{{{scale|1}}}*30}}}, |
− | "fontSize": {"value": 24}, | + | "fontSize": {"value": {{#expr:{{{scale|1}}}*24}}}, |
"fontWeight": {"value": "bold"}, | "fontWeight": {"value": "bold"}, | ||
"fill": {"value": "steelblue"} | "fill": {"value": "steelblue"} | ||
Line 256: | Line 278: | ||
}, | }, | ||
"title": { | "title": { | ||
− | "fontSize": {"value": 14} | + | "fontSize": {"value": {{#expr:{{{scale|1}}}*14}}} |
}, | }, | ||
"legend": { | "legend": { | ||
− | "x": {"value": | + | "x": {"value": {{#expr:{{{scale|1}}}*250}}}, |
− | "y": {"value": 60} | + | "y": {"value": {{#expr:{{{scale|1}}}*60}}} |
} | } | ||
} | } |
Latest revision as of 09:15, 9 August 2020
Usage example
{{Template:COVID-19 pandemic interactive maps/India |data-template = Template:COVID-19 pandemic interactive maps/India/India cases by region |legend-title = Cases |domain-upper-value = 5e5 }} {{Template:COVID-19 pandemic interactive maps/India |data-template = Template:COVID-19 pandemic interactive maps/India/India deaths by region |legend-title = Deaths |color-ramp-type = sqrt |domain-upper-value = 20000 }} {{Template:COVID-19 pandemic interactive maps/India |data-template = Template:COVID-19 pandemic interactive maps/India/India cases by region |legend-title = Cases per million population |color-ramp-type = linear |domain-upper-value = 8000 |per-capita = 1000000 |scale = 0.7 }} {{Template:COVID-19 pandemic interactive maps/India |data-template = Template:COVID-19 pandemic interactive maps/India/India deaths by region |legend-title = Deaths per million population |color-ramp-type = linear |domain-upper-value = 250 |per-capita = 1000000 |scale = 0.7 }}
Template parameters
A template for creating interactive data visualizations using maps for COVID-19 pandemic in India
Parameter | Description | Type | Status | |
---|---|---|---|---|
Region wise data | data-template | Dataset used to set the fill color for regions
| Page | required |
Title | title | Title for the graph
| String | suggested |
Scaling coefficient | scale | A percentage value (as a decimal) to resize the map
| Number | optional |
Color ramp type | color-ramp-type | Type of color ramping on map. Values can be 'linear','log' and 'sqrt'
| String | optional |
Density | per-capita | Creates per-capita map based on provided base
| Number | optional |
Padding | padding | no description
| Number | optional |
Minimum value in domain for map coloring | domain-lower-value | Value at which the coloring will begin
| Number | optional |
Maximum value in domain for map coloring | domain-upper-value | Value at which the coloring will end
| Number | required |
Beginning of color gradient | domain-lower-color | no description
| String | optional |
End of color gradient | domain-upper-color | no description
| String | optional |
Legend title | legend-title | Title for the map legend
| String | required |
See also
The above documentation is transcluded from Template:COVID-19 pandemic interactive maps/India/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |