Difference between revisions of "Template:Data bars/column"

From blackwiki
Jump to navigation Jump to search
imported>Jonathan Lane Studeman
imported>Jonathan Lane Studeman
Line 6: Line 6:
 
{{!}}
 
{{!}}
 
{{{!}} cellpadding="0" cellspacing="0"
 
{{{!}} cellpadding="0" cellspacing="0"
{{#ifexpr:{{{8|0}}}>0|
+
{{!}}-
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{8|0}}}}}|width={{#expr:{{{scale|1}}}*{{{8|0}}}}}|color={{{color8|#ddd}}}|name=<!----
+
{{!}} {{#ifexpr:{{{8|0}}}>0|
---------->{{#if:{{{detailed|}}}|{{{8|0}}}|}}}}|}}
+
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{8|0}}}}}|width={{#expr:{{{scale|1}}}*{{{8|0}}}}}|color={{{color8|#ddd}}}|name=<!----
{{#ifexpr:{{{7|0}}}>0|
+
---------->{{#if:{{{detailed|}}}|{{{8|0}}}|}}}}
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{7|0}}}}}|width={{#expr:{{{scale|1}}}*{{{7|0}}}}}|color={{{color7|#ddd}}}|name=<!----
+
{{!}} |}}<!---
---------->{{#if:{{{detailed|}}}|{{{7|0}}}|}}}}|}}
+
--->{{#ifexpr:{{{7|0}}}>0|
{{#ifexpr:{{{6|0}}}>0|
+
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{7|0}}}}}|width={{#expr:{{{scale|1}}}*{{{7|0}}}}}|color={{{color7|#ddd}}}|name=<!----
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{6|0}}}}}|width={{#expr:{{{scale|1}}}*{{{6|0}}}}}|color={{{color6|#ddd}}}|name=<!----
+
---------->{{#if:{{{detailed|}}}|{{{7|0}}}|}}}}
---------->{{#if:{{{detailed|}}}|{{{6|0}}}|}}}}|}}
+
{{!}} |}}<!---
{{#ifexpr:{{{5|0}}}>0|
+
--->{{#ifexpr:{{{6|0}}}>0|
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{5|0}}}}}|width={{#expr:{{{scale|1}}}*{{{5|0}}}}}|color={{{color5|#ddd}}}|name=<!----
+
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{6|0}}}}}|width={{#expr:{{{scale|1}}}*{{{6|0}}}}}|color={{{color6|#ddd}}}|name=<!----
---------->{{#if:{{{detailed|}}}|{{{5|0}}}|}}}}|}}
+
---------->{{#if:{{{detailed|}}}|{{{6|0}}}|}}}}
{{#ifexpr:{{{4|0}}}>0|
+
{{!}} |}}<!---
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{4|0}}}}}|width={{#expr:{{{scale|1}}}*{{{4|0}}}}}|color={{{color4|#ddd}}}|name=<!----
+
--->{{#ifexpr:{{{5|0}}}>0|
---------->{{#if:{{{detailed|}}}|{{{4|0}}}|}}}}|}}
+
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{5|0}}}}}|width={{#expr:{{{scale|1}}}*{{{5|0}}}}}|color={{{color5|#ddd}}}|name=<!----
{{#ifexpr:{{{3|0}}}>0|
+
---------->{{#if:{{{detailed|}}}|{{{5|0}}}|}}}}
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{3|0}}}}}|width={{#expr:{{{scale|1}}}*{{{3|0}}}}}|color={{{color3|#ddd}}}|name=<!----
+
{{!}} |}}<!---
---------->{{#if:{{{detailed|}}}|{{{3|0}}}|}}}}|}}
+
--->{{#ifexpr:{{{4|0}}}>0|
{{#ifexpr:{{{2|0}}}>0|
+
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{4|0}}}}}|width={{#expr:{{{scale|1}}}*{{{4|0}}}}}|color={{{color4|#ddd}}}|name=<!----
{{!}} {{Data bars/bar|title={{#if:{{{detailed|}}}||{{{2|0}}}}}|width={{#expr:{{{scale|1}}}*{{{2|0}}}}}|color={{{color2|#ddd}}}|name=<!----
+
---------->{{#if:{{{detailed|}}}|{{{4|0}}}|}}}}
---------->{{#if:{{{detailed|}}}|{{{2|0}}}|}}}}|}}<!------------
+
{{!}} |}}<!---
 +
--->{{#ifexpr:{{{3|0}}}>0|
 +
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{3|0}}}}}|width={{#expr:{{{scale|1}}}*{{{3|0}}}}}|color={{{color3|#ddd}}}|name=<!----
 +
---------->{{#if:{{{detailed|}}}|{{{3|0}}}|}}}} {{!}} |}}<!---
 +
--->{{#ifexpr:{{{2|0}}}>0|
 +
{{Data bars/bar|title={{#if:{{{detailed|}}}||{{{2|0}}}}}|width={{#expr:{{{scale|1}}}*{{{2|0}}}}}|color={{{color2|#ddd}}}|name=<!----
 +
---------->{{#if:{{{detailed|}}}|{{{2|0}}}|}}}}
 +
{{!}} |}}<!------------
 
---                                ---
 
---                                ---
 
---    then end with the first    ---
 
---    then end with the first    ---
 
---                                ---
 
---                                ---
-------------------------------------->
+
------------------>{{#ifexpr:{{{1|0}}}>0|
{{#ifexpr:{{{1|0}}}>0|
+
{{Data bars/bar<!---
{{!}} {{Data bars/bar<!---
 
 
--->|title={{#if:{{{detailed|}}}||{{{1|0}}}}}<!---
 
--->|title={{#if:{{{detailed|}}}||{{{1|0}}}}}<!---
 
--->|width={{#expr:{{{scale|1}}}*{{{1|0}}}}}<!---
 
--->|width={{#expr:{{{scale|1}}}*{{{1|0}}}}}<!---
 
--->|color={{{color1|#ddd}}}<!---
 
--->|color={{{color1|#ddd}}}<!---
 
--->|name=<!----
 
--->|name=<!----
---------->{{#if:{{{detailed|}}}|{{{1|0}}}|}}}}|}}
+
---------->{{#if:{{{detailed|}}}|{{{1|0}}}|}}}}
{{!}} valign="bottom" style="padding-left:2px;padding-bottom:2px;" {{!}} <small><!----------------------
+
{{!}} |}} valign="bottom" style="padding-left:2px;padding-bottom:2px;" {{!}} <small><!----------------------
 
---                        ---
 
---                        ---
 
---  adding up the column  ---
 
---  adding up the column  ---

Revision as of 07:22, 15 January 2015


This sub-template handles one "column" of data (zero and positive numbers only) to produce a bar for display inside a barchart table.

No more than eight numbers are accepted as unnamed parameters
Colors are named color1, color2, color3, and so on, up to eight colors.
A style number may be specified. If even, the bar is horizontal.
A scale number may be specified. If so, the bar size in pixels becomes scale times data.

The template call must be enclosed within a table.

Examples:
Default style = 1, scale = 1
{| <!------ begin table ------>

{{Data bars/column
|16|color1=red
|32|color2=yellow
|64|color3=green
|48|color4=blue
}}

|} <!------ end table ------>
160
Specified style = 2, scale = 0.001
{| <!------ begin table ------>

{{Data bars/column
|style = 2
|scale = 0.001
|16000|color1=red
|32000|color2=yellow
|64000|color3=green
|48000|color4=blue
}} 

|} <!------ end table ------> 
|
160000