Difference between revisions of "Template:Brick chart/Bricks/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Wikid77
(removed height shift of "+ 0.2" %)
imported>Wikid77
(allowed decimal {count} or {offset} by changing "{offset} mod {stride}" to formula "{offset|0} - {stride|10} * ( {offset|0}/{stride|10} round 0)" which allows fractional remainders.)
Line 1: Line 1:
 
<noinclude><!--
 
<noinclude><!--
 
-=============================================================================
 
-=============================================================================
-  Brick_chart/Bricks - Draw bricks for 1 value in {Brick_chart}
+
-  Brick_chart/Bricks - Draw bricks for 1 count in {Brick_chart} numbers
 
-=============================================================================
 
-=============================================================================
 
--                        (see NOTES at bottom)
 
--                        (see NOTES at bottom)
Line 10: Line 10:
 
   background:{{{color|silver}}};
 
   background:{{{color|silver}}};
 
   float:left;
 
   float:left;
   clear:{{#ifexpr:{{{offset|0}}} mod {{{stride|10}}} > 0|none|left}};
+
   clear:{{#ifexpr:{{{offset|0}}} - {{{stride|10}}} *
 +
          ( {{{offset|0}}}/{{{stride|10}}} round 0) > 0 |none|left}};
 
   height:{{#expr:100/{{{stride|10}}} }}%;
 
   height:{{#expr:100/{{{stride|10}}} }}%;
 
   overflow:hidden;
 
   overflow:hidden;
 
   width:{{#expr:
 
   width:{{#expr:
     {{min|{{#expr:({{{stride|10}}} - {{{offset|0}}} mod {{{stride|10}}})}}
+
     {{min|{{#expr: {{{stride|10}}} - ( {{{offset|0}}} - {{{stride|10}}} *
 +
            ( {{{offset|0}}}/{{{stride|10}}} round 0) ) }}
 
         |{{{count|0}}}}} * 100/{{{stride|10}}} }}%;
 
         |{{{count|0}}}}} * 100/{{{stride|10}}} }}%;
 
   ">&nbsp;</div>{{
 
   ">&nbsp;</div>{{
   #ifexpr:{{{count|0}}} > {{min|{{#expr:( {{{stride|10}}} -
+
   #ifexpr:{{{count|0}}} > {{min
      {{{offset|0}}} mod {{{stride|10}}})}}|{{{count|0}}} }}
+
      |{{#expr: {{{stride|10}}} - ( {{{offset|0}}} - {{{stride|10}}} *
 +
            ( {{{offset|0}}}/{{{stride|10}}} round 0) ) }}
 +
      |{{{count|0}}} }}
 
     |<!--show full-line bricks--><div style="
 
     |<!--show full-line bricks--><div style="
 
     background:{{{color|grey}}};
 
     background:{{{color|grey}}};
Line 26: Line 30:
 
     overflow:hidden;
 
     overflow:hidden;
 
     height:{{#expr:
 
     height:{{#expr:
       floor( ({{{count|0}}}
+
       floor( {{{count|0}}}
        - {{min|{{#expr:({{{stride|10}}}
+
      - {{min
          - {{{offset|0}}} mod {{{stride|10}}})}}|{{{count|0}}}}}
+
            |{{#expr: {{{stride|10}}} - ( {{{offset|0}}} - {{{stride|10}}} *
        - ( ({{{count|0}}} + {{{offset|0}}}) mod {{{stride|10}}})
+
                  ( {{{offset|0}}}/{{{stride|10}}} round 0) ) }}
        )/{{{stride|10}}}) * 100/{{{stride|10}}} }}%;<!--
+
            |{{{count|0}}}}}
 +
      - ( {{{count|0}}}+{{{offset|0}}} - {{{stride|10}}} *
 +
        ( ( {{{count|0}}}+{{{offset|0}}} )/{{{stride|10}}} round 0) ) )}}%<!--
 
     -->">&nbsp;</div>{{
 
     -->">&nbsp;</div>{{
     #ifexpr:(({{{count|0}}} + {{{offset|0}}}) mod {{{stride|10}}}) > 0
+
     #ifexpr:( {{{count|0}}}+{{{offset|0}}} - {{{stride|10}}} *
 +
            ( ( {{{count|0}}}+{{{offset|0}}})/{{{stride|10}}} round 0) ) > 0
 
       |<!--show final bricks (if any)--><div style="
 
       |<!--show final bricks (if any)--><div style="
 
         background:{{{color|silver}}};
 
         background:{{{color|silver}}};
Line 39: Line 46:
 
         overflow:hidden;
 
         overflow:hidden;
 
         height:{{#expr:100/{{{stride|10}}} }}%;
 
         height:{{#expr:100/{{{stride|10}}} }}%;
         width:{{#expr:( ({{{count|0}}} + {{{offset|0}}}) mod {{{stride|10}}}
+
         width:{{#expr: ( {{{count|0}}}+{{{offset|0}}} - {{{stride|10}}} *
                      ) * 100/{{{stride|10}}} }}%;<!--
+
            ( ( {{{count|0}}}+{{{offset|0}}})/{{{stride|10}}} round 0) )
 +
              * 100/{{{stride|10}}} }}%;<!--
 
         -->">&nbsp;</div>
 
         -->">&nbsp;</div>
 
     }}
 
     }}
Line 62: Line 70:
 
-17Sep2012 Fixed overlapped bars by full use of div-tag "overflow:hidden;".
 
-17Sep2012 Fixed overlapped bars by full use of div-tag "overflow:hidden;".
 
-17Sep2012 Added "overflow:hidden;" to 3rd line segment to match 1 & 2.
 
-17Sep2012 Added "overflow:hidden;" to 3rd line segment to match 1 & 2.
 +
-17Sep2012 Allowed decimals by replacing mod as: {c} - 10*( {c}/10 round 0).
 
-->
 
-->
  

Revision as of 16:36, 17 September 2012


The Template:Brick_chart/Bricks draws bricks for {{Brick chart}}.