Template:Articles by Importance Pie Graph

From blackwiki
(Redirected from Template:AbI Pie)
Jump to navigation Jump to search


Template documentation[view] [edit] [history] [purge]

Usage

This template will display a pie chart of your importance assessment data, that belong to a particular WikiProject. The syntax is as follows:

{{Articles by Importance Pie Graph
 |topic=
 |full=
 |Core=
 |Top=
 |High=
 |Mid=
 |Low=
 |bottom=
 |No=
 |NA=
 |Unknown=
}}

Parameters

  • |topic= (required) - set so that the quality categories are: "Foo-Class topic articles".
  • |full= (optional) - if set to yes 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

{{Articles by Importance Pie Graph|topic=Cheeses}}

will result in:

<graph> {

 "version": 2,
 "axes": [],
 "data": [
   {
     "name": "table",
     "values": [

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

     ]
   }
 ],
 "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": [
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                   ]
   }
 ],
 "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.

{{Articles by Importance Pie Graph|topic=Cheeses|full=yes}}

will result in:

<graph> {

 "version": 2,
 "axes": [],
 "data": [
   {
     "name": "table",
     "values": [

{ "col": "data", "idx": "Core-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "Top-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "High-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "Mid-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "Low-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "Bottom-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "No-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "NA-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

{ "col": "data", "idx": "Unknown-importance: Template:PAGESINCATEGORY", "val": Template:PAGESINCATEGORY },

     ]
   }
 ],
 "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.

{{Articles by Importance Pie Graph|topic=Cheeses|Top=black|High=#FFC0CB|Mid=#c5405b}}

will result in:

<graph> {

 "version": 2,
 "axes": [],
 "data": [
   {
     "name": "table",
     "values": [

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

Expression error: Unrecognized punctuation character "[".

     ]
   }
 ],
 "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": [
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                       Expression error: Unrecognized punctuation character "[".
                   ]
   }
 ],
 "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}}
{{class|GA}} {{class|B}} {{class|C}} {{class|Start}}
{{class|Stub}} {{class|List}} {{class|NA}} {{class|Unassessed}}
Non-standard class types
{{class|Current}} {{class|Future}} {{class|SIA}} {{class|Deferred}}
{{class|AL}} {{class|BL}} {{class|CL}} {{class|SL}}
{{class|Book}} {{class|Category}} {{class|Disambig}} {{class|Draft}}
{{class|File}} {{class|Merge}} {{class|Needed}} {{class|Portal}}
{{class|Project}} {{class|Redirect}} {{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
Importance
Hybrid
Others
Tool to add multiple templates to quality assessment pages