Widget:Radar: Difference between revisions

From Elwiki
mNo edit summary
mNo edit summary
Line 8: Line 8:
{| class="wikitable"
{| class="wikitable"
! Key !! Type !! Description !! Default
! Key !! Type !! Description !! Default
|-
| '''size''' || ''Number'' || Size of the chart || (Depends on parent container)
|-
|-
| '''dim''' || ''Integer'' || Number of axes ||
| '''dim''' || ''Integer'' || Number of axes ||
|-
| '''fontfamily''' || ''String'' || Name of font(s) || Microsoft YaHei
|-
| '''fontsize''' || ''Number'' || Font size || 18
|-
|-
| '''color''' || ''HexColor'' (#RRGGBB format only) || The color for the radar area ||
| '''color''' || ''HexColor'' (#RRGGBB format only) || The color for the radar area ||
Line 50: Line 56:
         <!--{/if}-->
         <!--{/if}-->
     <!--{/for}-->
     <!--{/for}-->
     <!--{$x1=$xmin*300}-->
     <!--{$x1=$xmin*280}-->
     <!--{$x2=$xmax*300}-->
     <!--{$x2=$xmax*280}-->
     <!--{$y1=$ymin*250}-->
     <!--{$y1=$ymin*250}-->
     <!--{$y2=$ymax*250}-->
     <!--{$y2=$ymax*250}-->
     <!--{$dx=$x2-$x1}-->
     <!--{$dx=$x2-$x1}-->
     <!--{$dy=$y2-$y1}-->
     <!--{$dy=$y2-$y1}-->
     <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="600" height="600" viewBox="<!--{$x1}--> <!--{$y1}--> <!--{$dx}--> <!--{$dy}-->" style="width: 100%">
     <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="<!--{$x1}--> <!--{$y1}--> <!--{$dx}--> <!--{$dy}-->" style="width: <!--{$size|default:'100%'}-->">
         <polygon stroke="#ccc" fill="#eee" points="
         <polygon stroke="#ccc" fill="#eee" points="
             <!--{for $i=1 to $dim}-->
             <!--{for $i=1 to $dim}-->
Line 85: Line 91:
         <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 transform="translate(<!--{($xs[$i]*230)|cat:','|cat:($ys[$i]*230)}-->)" fill="#000" text-anchor="middle"><!--{$label[$i-1]|default:''|escape:'html'}--></text>
         <text  
            transform="translate(<!--{($xs[$i]*230)|cat:','|cat:($ys[$i]*230)}-->)"
            fill="#000"
            text-anchor="middle"
            font-size="<!--{$fontsize|default:18}-->"
            font-family="<!--{$fontfamily|default:'Microsoft YaHei'}-->">
            <!--{$label[$i-1]|default:''|escape:'html'}-->
        </text>
         <!--{/for}-->
         <!--{/for}-->
         <polygon stroke-width="0" fill="<!--{$color}-->7f" points="
         <polygon stroke-width="0" fill="<!--{$color}-->7f" points="

Revision as of 07:30, 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 18
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