Stripped personal data from development repository
Samo Penic
2019-02-20 83c3f647c35477564b77cbc5b36d37d793d5442a
commit | author | age
83c3f6 1 # Radar
SP 2 A radar chart is a way of showing multiple data points and the variation between them.
3
4 They are often useful for comparing the points of two or more different data sets.
5
6 {% chartjs %}
7 {
8     "type": "radar",
9     "data": {
10         "labels": [
11             "Eating",
12             "Drinking",
13             "Sleeping",
14             "Designing",
15             "Coding",
16             "Cycling",
17             "Running"
18         ],
19         "datasets": [{
20             "label": "My First Dataset",
21             "data": [65, 59, 90, 81, 56, 55, 40],
22             "fill": true,
23             "backgroundColor": "rgba(255, 99, 132, 0.2)",
24             "borderColor": "rgb(255, 99, 132)",
25             "pointBackgroundColor": "rgb(255, 99, 132)",
26             "pointBorderColor": "#fff",
27             "pointHoverBackgroundColor": "#fff",
28             "pointHoverBorderColor": "rgb(255, 99, 132)",
29             "fill": true
30         }, {
31             "label": "My Second Dataset",
32             "data": [28, 48, 40, 19, 96, 27, 100],
33             "fill": true,
34             "backgroundColor": "rgba(54, 162, 235, 0.2)",
35             "borderColor": "rgb(54, 162, 235)",
36             "pointBackgroundColor": "rgb(54, 162, 235)",
37             "pointBorderColor": "#fff",
38             "pointHoverBackgroundColor": "#fff",
39             "pointHoverBorderColor": "rgb(54, 162, 235)",
40             "fill": true
41         }]
42     },
43     "options": {
44         "elements": {
45             "line": {
46                 "tension": 0,
47                 "borderWidth": 3
48             }
49         }
50     }
51 }
52 {% endchartjs %}
53
54 ## Example Usage
55 ```javascript
56 var myRadarChart = new Chart(ctx, {
57     type: 'radar',
58     data: data,
59     options: options
60 });
61 ```
62
63 ## Dataset Properties
64
65 The radar chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset. For example, the colour of a line is generally set this way.
66
67 All point* properties can be specified as an array. If these are set to an array value, the first value applies to the first point, the second value to the second point, and so on.
68
69 | Name | Type | Description
70 | ---- | ---- | -----------
71 | `label` | `String` | The label for the dataset which appears in the legend and tooltips.
72 | `backgroundColor` | `Color` | The fill color under the line. See [Colors](../general/colors.md#colors)
73 | `borderColor` | `Color` | The color of the line. See [Colors](../general/colors.md#colors)
74 | `borderWidth` | `Number` | The width of the line in pixels.
75 | `borderDash` | `Number[]` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash)
76 | `borderDashOffset` | `Number` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset)
77 | `borderCapStyle` | `String` | Cap style of the line. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap)
78 | `borderJoinStyle` | `String` | Line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin)
79 | `fill` | `Boolean/String` | How to fill the area under the line. See [area charts](area.md)
80 | `lineTension` | `Number` | Bezier curve tension of the line. Set to 0 to draw straightlines.
81 | `pointBackgroundColor` | `Color/Color[]` | The fill color for points.
82 | `pointBorderColor` | `Color/Color[]` | The border color for points.
83 | `pointBorderWidth` | `Number/Number[]` | The width of the point border in pixels.
84 | `pointRadius` | `Number/Number[]` | The radius of the point shape. If set to 0, the point is not rendered.
85 | `pointRotation` | `Number/Number[]` | The rotation of the point in degrees.
86 | `pointStyle` | `String/String[]/Image/Image[]` | Style of the point. [more...](#pointstyle)
87 | `pointHitRadius` | `Number/Number[]` | The pixel size of the non-displayed point that reacts to mouse events.
88 | `pointHoverBackgroundColor` | `Color/Color[]` | Point background color when hovered.
89 | `pointHoverBorderColor` | `Color/Color[]` | Point border color when hovered.
90 | `pointHoverBorderWidth` | `Number/Number[]` | Border width of point when hovered.
91 | `pointHoverRadius` | `Number/Number[]` | The radius of the point when hovered.
92
93 ### pointStyle
94 The style of point. Options are:
95 * 'circle'
96 * 'cross'
97 * 'crossRot'
98 * 'dash'.
99 * 'line'
100 * 'rect'
101 * 'rectRounded'
102 * 'rectRot'
103 * 'star'
104 * 'triangle'
105
106 If the option is an image, that image is drawn on the canvas using [drawImage](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/drawImage).
107
108 ## Configuration Options
109
110 Unlike other charts, the radar chart has no chart specific options.
111
112 ## Scale Options
113
114 The radar chart supports only a single scale. The options for this scale are defined in the `scale` property.
115
116 ```javascript
117 options = {
118     scale: {
119         // Hides the scale
120         display: false
121     }
122 };
123 ```
124
125 ## Default Options
126
127 It is common to want to apply a configuration setting to all created radar charts. The global radar chart settings are stored in `Chart.defaults.radar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
128
129 ## Data Structure
130
131 The `data` property of a dataset for a radar chart is specified as a an array of numbers. Each point in the data array corresponds to the label at the same index on the x axis.
132
133 ```javascript
134 data: [20, 10]
135 ```
136
137 For a radar chart, to provide context of what each point means, we include an array of strings that show around each point in the chart.
138
139 ```javascript
140 data: {
141     labels: ['Running', 'Swimming', 'Eating', 'Cycling'],
142     datasets: [{
143         data: [20, 10, 4, 2]
144     }]
145 }
146 ```