Template:Brick chart/doc

From blackwiki
< Template:Brick chart
Revision as of 09:02, 17 September 2012 by imported>Wikid77 (new section "Performance considerations".)
Jump to navigation Jump to search

Draws "brick charts" (poor man's substitute for pie charts), useful for showing percentages, seats in a legislature, etc.

Parameters

  • value1-value9 = values for each category. Values must be integers ("2"), not fractions ("1/2") or decimals ("2.1").
  • label1-label9 = labels for each category, displayed in the legend
  • color1-color9 = html colors to be used for each category, defaults to various colours
  • caption = the caption for the legend
  • total = the total number of bricks (defaults to 100)
  • stride = the number of bricks in each row, defaults to 10
  • unit = unit to display in the legend, default to %
  • width = the width of the chart in pixels, the height is calculated automatically
  • thumb = (left|right) where to thumb the chart, defaults to right

Examples

<div style="

 background:red;
 float:left;         
 clear:left;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:green;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:blue;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:yellow;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 

Expression error: Unrecognized punctuation character "[".<div style="

 background:magenta;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;

"> Expression error: Unrecognized punctuation character "[".<div style="

 background:cyan;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;

"> Expression error: Unrecognized punctuation character "[".

  one - 42 %
  two - 32 %
  three - 12 %
  four - 3 %
  five - 2 %
  six - 1 %
  other - 8 %

<div style="

 background:silver;
 float:left;         
 clear:left;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:#008;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:#08f;
 float:left;         
 clear:none;
 height:10%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".

religion in the Czech republic

  Atheists and agnostics - 59 %
  Catholics - 26.8 %
  Protestants - 2.5 %
  other - 11.7 %

<div style="

 background:black;
 float:left;         
 clear:left;
 height:5%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:#ccf;
 float:left;         
 clear:none;
 height:5%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:red;
 float:left;         
 clear:none;
 height:5%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 
Expression error: Unrecognized punctuation character "[".<div style="
 background:yellow;
 float:left;         
 clear:none;
 height:5%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;
"> 

Expression error: Unrecognized punctuation character "[".<div style="

 background:#800;
 float:left;         
 clear:none;
 height:5%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;

"> Expression error: Unrecognized punctuation character "[".<div style="

 background:green;
 float:left;         
 clear:none;
 height:5%;
 overflow:hidden;
 width:Expression error: Unrecognized punctuation character "[".%;

"> Expression error: Unrecognized punctuation character "[".

Seats in the German federal parliamet

Performance considerations

The Template:Brick_chart draws the chart by using div-tags ("<div>") to show colored bars for line segments of the calculated length. The template can format a brick chart within 1/6 second, so 3 brick charts could appear within a page and add only 1/2 second to reformat, or edit-preview. The initial creation of the template occurred in August 2009; however, the alignment for display problems with overlapped bars was fixed in September 2012, over 3 years later.

See also