JSFiddle - React, Tailwind, and code Playground
by Robert Tome
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script>
<canvas id="myChart" width="400" height="400"></canvas>
JavaScript
// polar sample displayed anticlockwise (chartjs)
var data = [
{
value: 220,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 150,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 180,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
},
];
var options = {
scaleShowLabelBackdrop : true,
scaleBackdropColor : "rgba(255,255,255,0.75)",
scaleBeginAtZero : true,
scaleBackdropPaddingY : 2,
scaleBackdropPaddingX : 2,
scaleShowLine : true,
segmentShowStroke : true,
segmentStrokeColor : "#fff",
segmentStrokeWidth : 2,
animationSteps : 100,
animationEasing : "easeOutBounce",
animateRotate : true,
animateScale : false,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
};
var ctx = document.getElementById("myChart").getContext("2d");
var myChart = new Chart(ctx).PolarArea(data, options);