Widget:Radar: Difference between revisions

From Elwiki
mNo edit summary
mNo edit summary
Line 15: Line 15:
| '''fontfamily''' || ''String'' || Name of font(s) || Microsoft YaHei
| '''fontfamily''' || ''String'' || Name of font(s) || Microsoft YaHei
|-
|-
| '''fontsize''' || ''Number'' || Font size || 28
| '''fontsize''' || ''Number'' || Font size || 24
|-
|-
| '''color''' || ''HexColor'' (#RRGGBB format only) || The color for the radar area ||
| '''color''' || ''HexColor'' (#RRGGBB format only) || The color for the radar area ||
|-
|-
| '''label''' || ''Array<String>'' || Label(s) for each axis in sequence, ''\n'' for new line || (Empty String)
| '''label''' || ''Array<String>'' || Label(s) for each axis in sequence || (Empty String)
|-
|-
| '''max''' || ''Array<Number>''<br>&nbsp;&nbsp;&nbsp;&nbsp;or<br>''Integer'' || Max value for each axis.
| '''max''' || ''Array<Number>''<br>&nbsp;&nbsp;&nbsp;&nbsp;or<br>''Integer'' || Max value for each axis.
Line 29: Line 29:
| '''value''' || ''Array<Number>'' || Value for each axis. || 0
| '''value''' || ''Array<Number>'' || Value for each axis. || 0
|}
|}
</noinclude><includeonly><div style="width: 100%;">
</noinclude><includeonly><div style="width: <!--{$size|default:'100%'}-->">
     <!--{strip}-->
     <!--{strip}-->
     <!--{$PI=3.14159265358979323846}-->
     <!--{$PI=3.14159265358979323846}-->
Line 63: Line 63:
     <!--{$dx=$x2-$x1}-->
     <!--{$dx=$x2-$x1}-->
     <!--{$dy=$y2-$y1}-->
     <!--{$dy=$y2-$y1}-->
     <!--{$fontcorrection=$fontsize|default:28}-->
     <!--{$fontcorrection=$fontsize|default:24}-->
     <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="<!--{$x1}--> <!--{$y1}--> <!--{$dx}--> <!--{$dy}-->" style="width: <!--{$size|default:'100%'}-->">
     <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="<!--{$x1}--> <!--{$y1}--> <!--{$dx}--> <!--{$dy}-->" style="width: 100%;">
         <polygon stroke="#ccc" fill="#eee" points="
         <polygon stroke="#ccc" fill="#eee" points="
             <!--{for $i=1 to $dim}-->
             <!--{for $i=1 to $dim}-->
Line 92: Line 92:
         <!--{for $i=1 to $dim}-->
         <!--{for $i=1 to $dim}-->
         <line x1="0" y1="0" x2="<!--{$xs[$i]*200}-->" y2="<!--{$ys[$i]*200}-->" stroke="#ccc"></line>
         <line x1="0" y1="0" x2="<!--{$xs[$i]*200}-->" y2="<!--{$ys[$i]*200}-->" stroke="#ccc"></line>
         <text  
         <text  
             transform="
             transform="
Line 101: Line 102:
             font-size="<!--{$fontcorrection}-->"
             font-size="<!--{$fontcorrection}-->"
             font-family="<!--{$fontfamily|default:'Microsoft YaHei'}-->">
             font-family="<!--{$fontfamily|default:'Microsoft YaHei'}-->">
             <!--{$label[$i-1]|default:''|escape:'html'}-->
             <!--{math equation="explode('\n', label)" label=$label[$i-1] assign="text"}-->
            <!--{foreach $text as $i => $val}-->
            <tspan dy="<!--{$i*$fontcorrection}-->"><!--{$val|default:''|escape:'html'}--></tspan>
         </text>
         </text>
         <!--{/for}-->
         <!--{/for}-->

Revision as of 08:14, 29 May 2020

Widget:Radar is a component for radar chart.

Arguments are listed as following:

  • Array argument(s) can be called multiple times.
Key Type Description Default
size Number Size of the chart (Depends on parent container)
dim Integer Number of axes
fontfamily String Name of font(s) Microsoft YaHei
fontsize Number Font size 24
color HexColor (#RRGGBB format only) The color for the radar area
label Array<String> Label(s) for each axis in sequence (Empty String)
max Array<Number>
    or
Integer
Max value for each axis.
  • When using an integer, all axes will have the same max value.
  • When using an array, each axis will use the corresponding max value.
  • When using an array but the corresponding max value is missing, the first value in the array will be used.
max[0] (Array Type)
value Array<Number> Value for each axis. 0