Show label, value or percentage.
{ legend: { display: false }, pieceLabel: { render: 'label' } }
{ pieceLabel: { render: 'percentage', fontColor: ['green', 'white', 'red'], precision: 2 } }
{ pieceLabel: { render: 'percentage', fontColor: function (data) { var rgb = hexToRgb(data.dataset.backgroundColor[data.index]); var threshold = 140; var luminance = 0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b; return luminance > threshold ? 'black' : 'white'; }, precision: 2 } }
{ pieceLabel: { render: 'value', fontSize: 14, fontStyle: 'bold', fontColor: '#000', fontFamily: '"Lucida Console", Monaco, monospace' } }
{ pieceLabel: { render: function (args) { return '$' + args.value; }, arc: true } }
{ pieceLabel: { render: 'label', arc: true, position: 'border' } }
{ pieceLabel: { render: 'label', fontColor: '#000', position: 'outside' } }
{ pieceLabel: { render: 'label', arc: true, fontColor: '#000', position: 'outside' } }
{ pieceLabel: { render: 'label', fontSize: 14, overlap: true } }
{ pieceLabel: { render: 'image', images: [ { src: 'taiwan.png', width: 32, height: 22 }, { src: 'jpan.png', width: 32, height: 22 }, { src: 'usa.png', width: 32, height: 22 } ] } }
{ pieceLabel: [ { render: 'label', position: 'outside' }, { render: 'percentage' } ] }
{ pieceLabel: [ { render: 'label', fontColor: '#000', position: 'outside' }, { render: 'percentage', fontColor: ['green', 'white', 'red'], precision: 2 } ] }