Template:Articles by Quality Pie Graph/doc

From English Wikipedia @ Freddythechick

Usage

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

<syntaxhighlight lang="wikitext" style="overflow:auto;"> <graph> {

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

{ "col": "data", "idx": "★ FA: 1,221", "val": 1221 },

{ "col": "data", "idx": "A-class: 1,193", "val": 1193 },

{ "col": "data", "idx": "GA-class: 1,248", "val": 1248 },

{ "col": "data", "idx": "B-class: 1,253", "val": 1253 },

{ "col": "data", "idx": "C-class: 647", "val": 647 },

{ "col": "data", "idx": "Start: 1,261", "val": 1261 },

{ "col": "data", "idx": "Stub: 1,258", "val": 1258 },

{ "col": "data", "idx": "★ FL: 1,334", "val": 1334 },

{ "col": "data", "idx": "List: 1,283", "val": 1283 },


     ]
   }
 ],
 "height": 250,
 "legends": [
   {
     "fill": "color",
     "offset": 20,
     "properties": {},
     "title": "Article Rating"
   }
 ],
 "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": [
                       "#6699FF",
                       "#66FFFF",
                       "#66FF66",
                       "#B2FF66",
                       "#FFFF66",
                       "#FFAA66",
                       "#FF6666",
                       "#6699FF",
                       "#AA88FF",
                       
                   ]
   }
 ],
 "width": 

} </graph> </syntaxhighlight>

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.
  • |FA=, |A=, |GA=, |B=, |C=, |Start=, |Stub=, |FL=, |List=, |Unassessed= (optional) – if set to a standard or HTML5 web color it will change the appropriate rating. By default, they are set to the standard rating colors.
  • |unassessed-show= (optional) – if set to yes it will show unassessed articles.
  • |width= – default is 300px

Examples

Basic

<syntaxhighlight lang="wikitext"> <graph> {

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









     ]
   }
 ],
 "height": 250,
 "legends": [
   {
     "fill": "color",
     "offset": 20,
     "properties": {},
     "title": "Article Rating"
   }
 ],
 "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 Rating"
   }
 ],
 "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": "★ FA: 0", "val": 0 },

{ "col": "data", "idx": "A-class: 0", "val": 0 },

{ "col": "data", "idx": "GA: 0", "val": 0 },

{ "col": "data", "idx": "B-class: 0", "val": 0 },

{ "col": "data", "idx": "C-class: 0", "val": 0 },

{ "col": "data", "idx": "Start: 0", "val": 0 },

{ "col": "data", "idx": "Stub: 0", "val": 0 },

{ "col": "data", "idx": "★ FL: 0", "val": 0 },

{ "col": "data", "idx": "List: 0", "val": 0 },


     ]
   }
 ],
 "height": 250,
 "legends": [
   {
     "fill": "color",
     "offset": 20,
     "properties": {},
     "title": "Article Rating"
   }
 ],
 "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": [
                       "#6699FF",
                       "#66FFFF",
                       "#66FF66",
                       "#B2FF66",
                       "#FFFF66",
                       "#FFAA66",
                       "#FF6666",
                       "#6699FF",
                       "#AA88FF",
                       
                   ]
   }
 ],
 "width": 300

} </graph> </syntaxhighlight>

will result in:

<graph> {

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

{ "col": "data", "idx": "★ FA: 0", "val": 0 },

{ "col": "data", "idx": "A-class: 0", "val": 0 },

{ "col": "data", "idx": "GA: 0", "val": 0 },

{ "col": "data", "idx": "B-class: 0", "val": 0 },

{ "col": "data", "idx": "C-class: 0", "val": 0 },

{ "col": "data", "idx": "Start: 0", "val": 0 },

{ "col": "data", "idx": "Stub: 0", "val": 0 },

{ "col": "data", "idx": "★ FL: 0", "val": 0 },

{ "col": "data", "idx": "List: 0", "val": 0 },


     ]
   }
 ],
 "height": 250,
 "legends": [
   {
     "fill": "color",
     "offset": 20,
     "properties": {},
     "title": "Article Rating"
   }
 ],
 "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": [
                       "#6699FF",
                       "#66FFFF",
                       "#66FF66",
                       "#B2FF66",
                       "#FFFF66",
                       "#FFAA66",
                       "#FF6666",
                       "#6699FF",
                       "#AA88FF",
                       
                   ]
   }
 ],
 "width": 300

} </graph>

Unassessed articles

By using the |unassessed-show= with yes, you can visualise the unassessed articles with the other categories.

<syntaxhighlight lang="wikitext"> <graph> {

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









     ]
   }
 ],
 "height": 250,
 "legends": [
   {
     "fill": "color",
     "offset": 20,
     "properties": {},
     "title": "Article Rating"
   }
 ],
 "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 Rating"
   }
 ],
 "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>

Different colours

By using the |FA=, |A=, |GA=, |B=, |C=, |Start=, |Stub=, |FL=, |List= or |Unassessed= 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 Rating"
   }
 ],
 "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 Rating"
   }
 ],
 "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.

See also

Standard class types
 FA  FL  FM  A
{{Class|FA}} {{Class|FL}} {{Class|FM}} {{Class|A}}
 GA 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  AL
{{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

Importance

Hybrid

Others