var defaultConfig = {
aspectRatio: 1,
- legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i = 0; i < data.datasets[0].data.length; i++){%><li><span style=\"background-color:<%=data.datasets[0].backgroundColor[i]%>\"><%if(data.labels && i < data.labels.length){%><%=data.labels[i]%><%}%></span></li><%}%></ul>",
+ legendCallback: function(chart) {
+ var text = [];
+ text.push('<ul class="' + chart.id + '-legend">');
+
+ if (chart.data.datasets.length) {
+ for (var i = 0; i < chart.data.datasets[0].data.length; ++i) {
+ text.push('<li><span style="background-color:' + chart.data.datasets[0].backgroundColor[i] + '">');
+ if (chart.data.labels[i]) {
+ text.push(chart.data.labels[i]);
+ }
+ text.push('</span></li>');
+ }
+ }
+
+ text.push('</ul>');
+ return text.join("");
+ }
};
Chart.PolarArea = function(context, config) {