mirror of
https://github.com/dolanmiu/docx.git
synced 2026-11-30 16:47:55 +01:00
4.7 KiB
4.7 KiB
Radar Charts
A radar chart has a spoke for each category, and draws each series as a line around the spokes. Use it to compare several qualities at once, such as a team's skills.
Charts shows how to import ChartRun and add a chart to a document.
A Radar Chart
new ChartRun({
type: "radar",
title: "Skills",
categories: ["Speed", "Strength", "Range", "Stamina", "Skill"],
series: [
{ name: "Alice", values: [4, 3, 5, 2, 4] },
{ name: "Bob", values: [3, 5, 2, 4, 3] },
],
valueAxis: { minimum: 0, maximum: 5, interval: 1 },
});
- The first category's spoke points up, and the others go round clockwise.
- Each value is a point on its category's spoke: the further out, the bigger the value. The rings are the value axis' gridlines.
- A
nullvalue leaves a gap in its line.
Markers and Filled Radar Charts
markers: truedraws a circle at each point, as Word's "Radar with Markers" does. Markers can have a shape and size of their own. See Markers.filled: truefills the area inside each series' line, as Word's "Filled Radar" does. A filled radar chart has no markers, and its series no lines.
new ChartRun({
type: "radar",
categories: ["Speed", "Strength", "Range", "Stamina", "Skill"],
series: [{ name: "Alice", values: [4, 3, 5, 2, 4] }],
filled: true,
});
Axes
categoryAxisis the labels at the end of the spokes, and the spokes themselves, which are its gridlines.valueAxisruns up the first spoke. Its gridlines are the rings, and it takes a range and a number format as any value axis does.
See Chart Axes.
Options
| Property | Type | Notes | Description |
|---|---|---|---|
type |
"radar" |
Required | |
categories |
(string | number)[] |
Required | The spokes, in order. See Chart Data |
series |
RadarChartSeries[] |
Required | { name, values, color?, markers?, line?, dataLabels?, pointLabels? }, with a value or null for each category |
markers |
boolean | ChartMarker |
Optional | A marker at each point. Default false. See Markers |
filled |
boolean |
Optional | Fills each series' area. Default false |
categoryAxis |
ChartAxis |
Optional | The spokes and their labels. See Chart Axes |
valueAxis |
ChartValueAxis |
Optional | The axis up the first spoke. See Chart Axes |
dataLabels |
ChartDataLabels |
Optional | See Chart Data Labels. A radar chart's labels have no position |
emptyValues |
"gap" | "zero" | "connect" |
Optional | How null is drawn. Default "gap". See Empty Values |
title |
string | ChartTitle |
Optional | See Chart Titles and Legends |
legend |
false | ChartLegend |
Optional | See Chart Titles and Legends |
transformation |
{ width, height } |
Optional | See Chart Size and Position |
floating |
IFloating |
Optional | See Chart Size and Position |
altText |
DocPropertiesOptions |
Optional | See Chart Size and Position |
Chart Fonts and Fills shows the options every chart has for its text, background and border.