Template:Articles by Importance Pie Graph
Usage
This template will display a pie chart of your importance assessment data, that belong to a particular WikiProject. The syntax is as follows: <syntaxhighlight lang="wikitext"> <graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
{ "col": "data", "idx": "Top-importance: 1,095", "val": 1095 },
{ "col": "data", "idx": "High-importance: 1,145", "val": 1145 },
{ "col": "data", "idx": "Mid-importance: 1,126", "val": 1126 },
{ "col": "data", "idx": "Low-importance: 1,144", "val": 1144 },
{ "col": "data", "idx": "Bottom-importance: 12", "val": 12 },
{ "col": "data", "idx": "NA-importance: 1,093", "val": 1093 },
{ "col": "data", "idx": "Unknown-importance: 1,113", "val": 1113 },
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ "#ff00ff", "#ff88ff", "#ffbbff", "#ffddff", "#ffeeff", "#f5f5f5", "#D3D3D3", ] } ], "width": 300
} </graph>
</syntaxhighlight>
Parameters
|topic=
(required) - set so that the quality categories are: "Foo-Class topic articles".|full=
(optional) - if set toyes
it will show full legend. By default, only the categories with articles show in the legend.|Core=
,|Top=
,|High=
,|Mid=
,|Low=
,|Bottom=
,|No=
,|NA=
, or|Unknown=
(optional) - if set to a standard or HTML5 web color it will change the appropriate importance rating. By default, they are set to the standard importance rating colors.
Examples
Basic
<syntaxhighlight lang="wikitext"> <graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ ] } ], "width": 300
} </graph>
</syntaxhighlight>
will result in:
<graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ ] } ], "width": 300
} </graph>
Full Legend
By using the |full=
with yes
, you can show the entire legend - even if there are no articles in the categories.
<syntaxhighlight lang="wikitext"> <graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
{ "col": "data", "idx": "Core-importance: 0", "val": 0 },
{ "col": "data", "idx": "Top-importance: 0", "val": 0 },
{ "col": "data", "idx": "High-importance: 0", "val": 0 },
{ "col": "data", "idx": "Mid-importance: 0", "val": 0 },
{ "col": "data", "idx": "Low-importance: 0", "val": 0 },
{ "col": "data", "idx": "Bottom-importance: 0", "val": 0 },
{ "col": "data", "idx": "No-importance: 0", "val": 0 },
{ "col": "data", "idx": "NA-importance: 0", "val": 0 },
{ "col": "data", "idx": "Unknown-importance: 0", "val": 0 },
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ "#ff00ff", "#ff00ff", "#ff88ff", "#ffbbff", "#ffddff", "#ffeeff", "#ffffff", "#f5f5f5", "#D3D3D3", ] } ], "width": 300
} </graph>
</syntaxhighlight>
will result in:
<graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
{ "col": "data", "idx": "Core-importance: 0", "val": 0 },
{ "col": "data", "idx": "Top-importance: 0", "val": 0 },
{ "col": "data", "idx": "High-importance: 0", "val": 0 },
{ "col": "data", "idx": "Mid-importance: 0", "val": 0 },
{ "col": "data", "idx": "Low-importance: 0", "val": 0 },
{ "col": "data", "idx": "Bottom-importance: 0", "val": 0 },
{ "col": "data", "idx": "No-importance: 0", "val": 0 },
{ "col": "data", "idx": "NA-importance: 0", "val": 0 },
{ "col": "data", "idx": "Unknown-importance: 0", "val": 0 },
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ "#ff00ff", "#ff00ff", "#ff88ff", "#ffbbff", "#ffddff", "#ffeeff", "#ffffff", "#f5f5f5", "#D3D3D3", ] } ], "width": 300
} </graph>
Different Colours
By using the |Core=
, |Top=
, |High=
, |Mid=
, |Low=
, |Bottom=
, |No=
, or |NA=
with a web color, you can change the chart color.
<syntaxhighlight lang="wikitext"> <graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ ] } ], "width": 300
} </graph>
</syntaxhighlight>
will result in:
<graph> {
"version": 2, "axes": [], "data": [ { "name": "table", "values": [
] } ], "height": 250, "legends": [ { "fill": "color", "offset": 20, "properties": {}, "title": "Article Importance" } ], "marks": [ { "type": "arc", "from": { "data": "table", "transform": [{"type": "pie","field": "val"}] }, "properties": { "enter": { "x": {"field": {"group": "width"},"mult": 0.5}, "y": {"field": {"group": "height"},"mult": 0.5}, "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "fill": {"field": "idx","scale": "color"}, "innerRadius": {"value": 0}, "outerRadius": {"value": 125}, "stroke": {"value": "white"} } } } ], "padding": "auto", "scales": [ { "domain": {"data": "table", "field": "idx"}, "name": "color", "type": "ordinal", "range": [ ] } ], "width": 300
} </graph>
Acknowledgement
This template came from an idea first created by User:Kopiersperre on Version 1.0 Editorial Team's statistics page and was copied from {{Articles by Quality Pie Graph}}.
See also
Standard class types | |||
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
{{Class|FA}} | {{Class|FL}} | {{Class|FM}} | {{Class|A}} |
![]() |
B | C | Start |
{{Class|GA}} | {{Class|B}} | {{Class|C}} | {{Class|Start}} |
Stub | List | NA | ??? |
{{Class|Stub}} | {{Class|List}} | {{Class|NA}} | {{Class|Unassessed}} |
Non-standard class types | |||
Future | SIA | ![]() |
|
{{Class|Future}} | {{Class|SIA}} | {{Class|AL}} | |
BL | CL | Category | |
{{Class|BL}} | {{Class|CL}} | {{Class|Category}} | |
Disambig | Draft | File | |
{{Class|Disambig}} | {{Class|Draft}} | {{Class|File}} | |
Needed | Portal | Project | Redirect |
{{Class|Needed}} | {{Class|Portal}} | {{Class|Project}} | {{Class|Redirect}} |
Template | User | ||
{{Class|Template}} | {{Class|User}} | ||
Importance types | |||
Top | High | Mid | Low |
{{Importance|Top}} | {{Importance|High}} | {{Importance|Mid}} | {{Importance|Low}} |
Bottom | NA | ??? | |
{{Importance|Bottom}} | {{Importance|NA}} | {{Importance|Unknown}} |
Class
- {{Article classification}}
- {{Grading scheme}}
- {{Assessment Class Summary}}
- {{Category class}}
- {{Articles by Quality}}
- {{Class}}
Importance
- {{Article importance}}
- {{Importance scheme}}
- {{Assessment Importance Summary}}
- {{Category importance}}
- {{Articles by Importance}}
- {{Importance}}
- {{Importance/colour}}
- {{Importance/icon}}