Radar
Comprehensive comparison of differences between multiple sets of data in two-dimensional form, often used to compare 2 or more sets of data
Code demo
xml
<r-radar
abilitys='[{"abilityName":"HP","scoreRate":"10"},{"abilityName":"Attack","scoreRate":"90"},{"abilityName":"DEF","scoreRate":"20"},{"abilityName":"Element mastery","scoreRate":"50"},{"abilityName":"Critical Hit Chance","scoreRate":"80"},{"abilityName":"Critical hit damage","scoreRate":"50"}]'
style="width:300px;height:300px;display: block;"
>
</r-radar>
Attribute
abilitys
Data that needs to be presented
An array object with the following properties
key | Description | type |
---|---|---|
abilityName | Displays the attribute name | 'string' |
scoreRate | Displays the dimension value. The maximum value is 100 | 'number' |
backgroundColor | The background color of the | property is an optional string |
fontSize | The font size for the attribute name | The optional parameter 'number' |
fontFamily | The font for the attribute name | is optional with 'string' |
fontColor | The font color for the | property is an optional parameter with string |
xml
<r-radar
abilitys='[{"abilityName":"HP","scoreRate":"10","backgroundColor":"red","fontSize":"30","fontColor":"blue"},{"abilityName":"Attack","scoreRate":"90"},{"abilityName":"DEF","scoreRate":"20"},{"abilityName":"Element mastery","scoreRate":"50"},{"abilityName":"Critical Hit Chance","scoreRate":"80"},{"abilityName":"Critical hit damage","scoreRate":"50"}]'
style="width:300px;height:300px;display: block;"
>
</r-radar>
colorPolygon
xml
<r-radar
colorPolygon="green"
abilitys='[{"abilityName":"HP","scoreRate":"10"},{"abilityName":"Attack","scoreRate":"90"},{"abilityName":"DEF","scoreRate":"20"},{"abilityName":"Element mastery","scoreRate":"50"},{"abilityName":"Critical Hit Chance","scoreRate":"80"},{"abilityName":"Critical hit damage","scoreRate":"50"}]'
style="width:300px;height:300px;display: block;"
>
</r-radar>
colorLine
xml
<r-radar
colorLine="blue"
abilitys='[{"abilityName":"HP","scoreRate":"10"},{"abilityName":"Attack","scoreRate":"90"},{"abilityName":"DEF","scoreRate":"20"},{"abilityName":"Element mastery","scoreRate":"50"},{"abilityName":"Critical Hit Chance","scoreRate":"80"},{"abilityName":"Critical hit damage","scoreRate":"50"}]'
></r-radar>
fillColor
xml
<r-radar
fillColor="red"
abilitys='[{"abilityName":"HP","scoreRate":"10"},{"abilityName":"Attack","scoreRate":"90"},{"abilityName":"DEF","scoreRate":"20"},{"abilityName":"Element mastery","scoreRate":"50"},{"abilityName":"Critical Hit Chance","scoreRate":"80"},{"abilityName":"Critical hit damage","scoreRate":"50"}]'
style="width:300px;height:300px;display: block;"
>
</r-radar>
strokeColor
xml
<r-radar
strokeColor="blue"
abilitys='[{"abilityName":"HP","scoreRate":"10"},{"abilityName":"Attack","scoreRate":"90"},{"abilityName":"DEF","scoreRate":"20"},{"abilityName":"Element mastery","scoreRate":"50"},{"abilityName":"Critical Hit Chance","scoreRate":"80"},{"abilityName":"Critical hit damage","scoreRate":"50"}]'
style="width:300px;height:300px;display: block;"
>
</r-radar>
Example data used
Because the 'attribute' of 'HTMl' can only get 'string'. Therefore, the data that needs to be passed in needs to be in the format of 'JSON' string, and then parsed by 'json.parse' array object, if the 'JSON' format is wrong, it cannot be parsed.
json
[
{
"abilityName": "HP",
"scoreRate": "10",
"backgroundColor": "red",
"fontSize": "30",
"fontColor": "blue"
},
{
"abilityName": "Attack",
"scoreRate": "90"
},
{
"abilityName": "DEF",
"scoreRate": "20"
},
{
"abilityName": "Element mastery",
"scoreRate": "50"
},
{
"abilityName": "Critical Hit Chance",
"scoreRate": "80"
},
{
"abilityName": "Critical hit damage",
"scoreRate": "50"
}
]