react-chartjs
react-chartjs copied to clipboard
How to write the custom label inside donuts chart
I am using the implementation in reactJs component and I am not understanding how I can write the custom label inside donuts chart. I am not able to found any hint for this. Could you please lets us know how to set the custom label.
any update on this?
You'll need to use the chart options object:
http://www.chartjs.org/docs/#doughnut-pie-chart-chart-options
Thanks for the reply. I saw this options before but I am using react-chartjs component and haven't found any configuration for showing data in the center of the donuts chart specific to component. I am getting the canvas object from DOM do you know is there any way to show data in the center using this object.
Any update on this ? i also need the same functionality
@pankaj805 See my comment here if you are still looking for a solution. https://github.com/chartjs/Chart.js/issues/78#issuecomment-289264197
Hi, this solution dosnt work on my code. Can someone help me? This is my code.
`var config = { type: 'doughnut', data: { datasets: [{ data: [ data.VSTPS_OEEDATOF[0].PctOEE, "100" - data.VSTPS_OEEDATOF[0].PctOEE, ], backgroundColor: [ "#8A8A8A", "#FFFFFF", ] }, { data: [ "100", ], backgroundColor: [ "#DED6D6", ] } ] }, options: { responsive: true, elements: { center: { text: '90%', color: '#FF6384', fontStyle: 'Arial', sidePadding: 20, } } } };
var ctx = document.getElementById("chart-area").getContext("2d");
window.myDoughnut = new Chart(ctx, config);`
And this my html plage
<div id="canvas-holder" style="width:18%"> <canvas id="chart-area" /> </div>
Thank you in advise.