7 A radar chart is a way of showing multiple data points and the variation between them.
9 They are often useful for comparing the points of two or more different data sets.
11 <div class="canvas-holder">
12 <canvas width="250" height="125"></canvas>
18 var myRadarChart = new Chart(ctx).Radar(data, options);
24 labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
27 label: "My First dataset",
28 fillColor: "rgba(220,220,220,0.2)",
29 strokeColor: "rgba(220,220,220,1)",
30 pointColor: "rgba(220,220,220,1)",
31 pointStrokeColor: "#fff",
32 pointHighlightFill: "#fff",
33 pointHighlightStroke: "rgba(220,220,220,1)",
34 data: [65, 59, 90, 81, 56, 55, 40]
37 label: "My Second dataset",
38 fillColor: "rgba(151,187,205,0.2)",
39 strokeColor: "rgba(151,187,205,1)",
40 pointColor: "rgba(151,187,205,1)",
41 pointStrokeColor: "#fff",
42 pointHighlightFill: "#fff",
43 pointHighlightStroke: "rgba(151,187,205,1)",
44 data: [28, 48, 40, 19, 96, 27, 100]
49 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.
50 For the radar chart data, we have an array of datasets. Each of these is an object, with a fill colour, a stroke colour, a colour for the fill of each point, and a colour for the stroke of each point. We also have an array of data values.
52 The label key on each dataset is optional, and can be used when generating a scale for the chart.
56 These are the customisation options specific to Radar charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
61 //Boolean - Whether to show lines for each scale point
64 //Boolean - Whether we show the angle lines out of the radar
65 angleShowLineOut : true,
67 //Boolean - Whether to show labels on the scale
68 scaleShowLabels : false,
70 // Boolean - Whether the scale should begin at zero
71 scaleBeginAtZero : true,
73 //String - Colour of the angle line
74 angleLineColor : "rgba(0,0,0,.1)",
76 //Number - Pixel width of the angle line
79 //String - Point label font declaration
80 pointLabelFontFamily : "'Arial'",
82 //String - Point label font weight
83 pointLabelFontStyle : "normal",
85 //Number - Point label font size in pixels
86 pointLabelFontSize : 10,
88 //String - Point label font colour
89 pointLabelFontColor : "#666",
91 //Boolean - Whether to show a dot for each point
94 //Number - Radius of each point dot in pixels
97 //Number - Pixel width of point dot stroke
98 pointDotStrokeWidth : 1,
100 //Number - amount extra to add to the radius to cater for hit detection outside the drawn point
101 pointHitDetectionRadius : 20,
103 //Boolean - Whether to show a stroke for datasets
104 datasetStroke : true,
106 //Number - Pixel width of dataset stroke
107 datasetStrokeWidth : 2,
109 //Boolean - Whether to fill the dataset with a colour
112 //String - A legend template
113 legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
119 You can override these for your `Chart` instance by passing a second argument into the `Radar` method as an object with the keys you want to override.
121 For example, we could have a radar chart without a point for each on piece of data by doing the following:
124 new Chart(ctx).Radar(data, {
127 // This will create a chart with all of the default options, merged from the global config,
128 // and the Bar chart defaults but this particular instance will have `pointDot` set to false.
131 We can also change these defaults values for each Radar type that is created, this object is available at `Chart.defaults.Radar`.
134 ### Prototype methods
136 #### .getPointsAtEvent( event )
138 Calling `getPointsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the point elements that are at that the same position of that event.
141 canvas.onclick = function(evt){
142 var activePoints = myRadarChart.getPointsAtEvent(evt);
143 // => activePoints is an array of points on the canvas that are at the same position as the click event.
147 This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
151 Calling `update()` on your Chart instance will re-render the chart with any updated values, allowing you to edit the value of multiple existing points, then render those in one animated render loop.
154 myRadarChart.datasets[0].points[2].value = 50;
155 // Would update the first dataset's value of 'Sleeping' to be 50
156 myRadarChart.update();
157 // Calling update now animates the position of Sleeping from 90 to 50.
160 #### .addData( valuesArray, label )
162 Calling `addData(valuesArray, label)` on your Chart instance passing an array of values for each dataset, along with a label for those points.
165 // The values array passed into addData should be one for each dataset in the chart
166 myRadarChart.addData([40, 60], "Dancing");
167 // The new data will now animate at the end of the chart.
172 Calling `removeData()` on your Chart instance will remove the first value for all datasets on the chart.
175 myRadarChart.removeData();
176 // Other points will now animate to their correct positions.