Difference between revisions of "PieChartSegment"

From Sega Retro

Line 1: Line 1:
<includeonly><div style="display:none;">
+
<includeonly>{{#vardefine:angle|{{{angle|}}}}}
{{#vardefine:size|{{#expr:{{#var:radius}} * 2}}}}
+
    #{{{colour}}} {{#var:totalAngles}}deg {{#var:angle}}deg,{{#vardefine:totalAngles|{{#expr:{{#var:totalAngles}}+{{#var:angle}}}}}}
{{#vardefine:angle|{{{angle|}}}}}
 
{{#vardefine:adj|{{#expr:cos({{Deg2Rad|{{#var:angle}}/2}})*{{#var:size}}}}}}
 
</div><div style="line-height:0px;
 
            border-left: {{#var:size}}px solid transparent;
 
            border-right: {{#var:size}}px solid transparent;
 
            border-top: {{#var:size}}px solid transparent;
 
            border-bottom: {{#var:adj}}px solid green;
 
            width:0px; transform-origin:{{#var:size}}px {{#var:size}}px; transform: translate(-{{#expr:{{#var:size}}/2}}px, -{{#expr:{{#var:size}}/2}}px) rotate(-{{#expr:45}}deg)">{{#var:adj}}</div><div style="display:none;">
 
 
 
<!--{{#vardefine:skewangle|{{#expr:90-{{{angle|}}}}}}}
 
{{#vardefine:opp|{{#var:radius}}}}
 
{{#vardefine:hyp|{{#expr:{{#var:opp}}/sin({{Deg2Rad|{{#expr:90-{{#var:skewangle}}}}}})}}}}
 
{{#vardefine:adj|{{#expr:sqrt(({{#var:hyp}}^2) - ({{#var:opp}}^2))}}}}
 
 
 
{{#vardefine:translationX|{{#expr:{{#var:radius}}+({{#var:adj}}/2)}}}}
 
{{#vardefine:translationY|{{#var:radius}}}}
 
 
 
</div><div style="transform:translate({{#var:translationX}}px, {{#expr:(-{{#var:oldTranslationY}}) + {{#var:translationY}}}}px) rotate({{#expr:{{#var:oldAngle}}}}deg);"><div style="width:{{#var:radius}}px; height:{{#var:radius}}px; background-color:#{{{colour|}}}{{{color|}}}; border:0px; transform: skew({{#var:skewangle}}deg); position:relative;"></div></div>{{
 
#vardefine:oldTranslationX|{{#var:translationX}}}}{{
 
#vardefine:oldTranslationY|{{#var:translationY}}}}{{
 
#vardefine:oldAngle|{{{angle|}}}-->
 
}}
 
 
</includeonly><noinclude>
 
</includeonly><noinclude>
{{#vardefine:oldTranslationX|0}}{{#vardefine:oldTranslationY|0}}{{#vardefine:oldAngle|0}}
+
{{#vardefine:totalAngles|0}}
 
{{PieChart|
 
{{PieChart|
 
{{PieChartSegment
 
{{PieChartSegment
Line 31: Line 9:
 
}}
 
}}
 
{{PieChartSegment
 
{{PieChartSegment
| angle=20
+
| angle=45
 
| colour=FF00FF
 
| colour=FF00FF
 
}}
 
}}
 
}}
 
}}
 
 
 
 
 
  
 
[[Category:Templates]]</noinclude>
 
[[Category:Templates]]</noinclude>

Revision as of 04:24, 10 March 2022