Changes
Jump to navigation
Jump to search
Template:Graph:Pie from row/doc (view source)
Revision as of 20:10, 26 December 2016
, 20:10, 26 December 2016no edit summary
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
== Pie chart ==
You can add a pie chart with a call to this template.
== Examples ==
'''Example usage''':
{| class="wikitable"
! style="text-align: left;" | '''<nowiki>{{</nowiki>Graph:Pie from row<br>
| table = Bea.gov/GDP by state.tab<br>
| rowtest = year==2015<br>
| series = "TX","CA","NY"<br>
| show = label<br>
| legend = Relative GDP<br>
| radius = 125<br>
<nowiki>}}</nowiki>'''
! style="text-align: left;" | '''<nowiki>{{</nowiki>Graph:Pie from row<br>
| table = Bea.gov/GDP by state.tab<br>
| rowtest = year==2015<br>
| series = "AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"<br>
| legend = -<br>
| radius = 125<br>
<nowiki>}}</nowiki>'''
|-
| {{Graph:Pie from row
| table = Bea.gov/GDP by state.tab
| rowtest = year==2015
| series = "TX","CA","NY"
| show = label
| legend = Relative GDP
| radius = 125
}}
| {{Graph:Pie from row
| table = Bea.gov/GDP by state.tab
| rowtest = year==2015
| series = "AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"
| legend = -
| radius = 125
}}
|}
=== Template Data ===
<templatedata>
{
"params": {
"radius": {
"label": "Radius",
"description": "Specify the radius of the pie in number of pixels",
"example": "100",
"default": "100",
"type": "number",
"suggested": true
},
"legend": {
"label": "Legend Title",
"description": "The title that will appear above the legend, or '-' to hide it",
"example": "\"Fruits\"",
"type": "string",
"default": "\"Legend\"",
"suggested": true
},
"table": {
"description": "Data page name on Commons, without the Data: prefix. The table should contain series columns to plot, and the rowtest to select which row to use",
"required": true,
"example": "bea.gov/GDP by state.tab"
},
"colors": {
"label": "The colors of the slices",
"description": "The colors of the slices, specified as Vega defined rangeliteral. This can also be a list like [ \"red\", \"green\" ]",
"example": "\"category10\"",
"type": "string",
"default": "\"category10\""
},
"debug": {},
"rowtest": {
"description": "a condition to select just one row of the data for the display",
"example": "year==2015",
"type": "string",
"required": true
},
"series": {
"description": "Data page name on Commons, without the Data: prefix. The table should contain xField column, like year or date, and one or more series columns to plot",
"type": "string",
"required": true
},
"show": {
"description": "Show \"label\", \"value\" or \"both\" inside the pie chart",
"type": "string"
},
"title": {
"description": "Optional title for the graph",
"type": "string"
}
},
"description": "This template adds a pie chart to the page using Graph extension",
"format": "inline",
"paramOrder": [
"table",
"series",
"rowtest",
"radius",
"legend",
"colors",
"show",
"title",
"debug"
]
}
</templatedata>
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
[[Category:Graph Template Collection]]
}}</includeonly>
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
== Pie chart ==
You can add a pie chart with a call to this template.
== Examples ==
'''Example usage''':
{| class="wikitable"
! style="text-align: left;" | '''<nowiki>{{</nowiki>Graph:Pie from row<br>
| table = Bea.gov/GDP by state.tab<br>
| rowtest = year==2015<br>
| series = "TX","CA","NY"<br>
| show = label<br>
| legend = Relative GDP<br>
| radius = 125<br>
<nowiki>}}</nowiki>'''
! style="text-align: left;" | '''<nowiki>{{</nowiki>Graph:Pie from row<br>
| table = Bea.gov/GDP by state.tab<br>
| rowtest = year==2015<br>
| series = "AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"<br>
| legend = -<br>
| radius = 125<br>
<nowiki>}}</nowiki>'''
|-
| {{Graph:Pie from row
| table = Bea.gov/GDP by state.tab
| rowtest = year==2015
| series = "TX","CA","NY"
| show = label
| legend = Relative GDP
| radius = 125
}}
| {{Graph:Pie from row
| table = Bea.gov/GDP by state.tab
| rowtest = year==2015
| series = "AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"
| legend = -
| radius = 125
}}
|}
=== Template Data ===
<templatedata>
{
"params": {
"radius": {
"label": "Radius",
"description": "Specify the radius of the pie in number of pixels",
"example": "100",
"default": "100",
"type": "number",
"suggested": true
},
"legend": {
"label": "Legend Title",
"description": "The title that will appear above the legend, or '-' to hide it",
"example": "\"Fruits\"",
"type": "string",
"default": "\"Legend\"",
"suggested": true
},
"table": {
"description": "Data page name on Commons, without the Data: prefix. The table should contain series columns to plot, and the rowtest to select which row to use",
"required": true,
"example": "bea.gov/GDP by state.tab"
},
"colors": {
"label": "The colors of the slices",
"description": "The colors of the slices, specified as Vega defined rangeliteral. This can also be a list like [ \"red\", \"green\" ]",
"example": "\"category10\"",
"type": "string",
"default": "\"category10\""
},
"debug": {},
"rowtest": {
"description": "a condition to select just one row of the data for the display",
"example": "year==2015",
"type": "string",
"required": true
},
"series": {
"description": "Data page name on Commons, without the Data: prefix. The table should contain xField column, like year or date, and one or more series columns to plot",
"type": "string",
"required": true
},
"show": {
"description": "Show \"label\", \"value\" or \"both\" inside the pie chart",
"type": "string"
},
"title": {
"description": "Optional title for the graph",
"type": "string"
}
},
"description": "This template adds a pie chart to the page using Graph extension",
"format": "inline",
"paramOrder": [
"table",
"series",
"rowtest",
"radius",
"legend",
"colors",
"show",
"title",
"debug"
]
}
</templatedata>
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
[[Category:Graph Template Collection]]
}}</includeonly>