var colors = ['#208DF8', '#E9485E', '#FF9900', '#2DCB67'], labels = ['Paid', 'Overdue', 'Partial', 'Draft'], data = [2, 1, 2, 3], bgColor = colors, dataChart = { labels: labels, datasets: [{ data: data, backgroundColor: bgColor }] }, config = { type: 'doughnut', data: dataChart, options: { maintainAspectRatio: true, cutoutPercentage: 45, legend: { display: false }, // generate custom labels legendCallback: function(chart) { var text = []; text.push(''); return text.join(""); }, } }; setTimeout(function() { var status_chart_ctx = document.getElementById('status_chart'); if ( status_chart_ctx !== null ) { status_chart_ctx = status_chart_ctx.getContext("2d"), status_chart = new Chart(status_chart_ctx, config), status_legend = status_chart.generateLegend(), status_legendHolder = document.getElementById("status_legend"); status_legendHolder.innerHTML = status_legend } }, 1000);