onClick on pie chart


Topic: onClick on pie chart

master saketh asked 5 years ago

Expected behavior when clicked on a particular sector of the piechart, i need to display the label of the data it is representing

my code is:

canvas id="pieChart" style="margin:0 auto;"> canvas>

var myPieChart = new Chart(ctxP, type: 'pie',

data: { labels: ["Success", "Failure", "Partial Success", "Started", "Cancelled"], datasets: [{ data: [2343, 897, 1243, 8990, 43432], backgroundColor: ["#46BFBD","#F7464A", "#FDB45C", "#949FB1", "#4D5360"], hoverBackgroundColor: ["#5AD3D1", "#FF5A5E", "#FFC870", "#A8B3C5", "#616774"] }] },

options: { responsive: false, legend: { position: 'right', }

}

});


MDBootstrap staff pro premium priority commented 5 years ago

I can not understand your code. Please create a snippet with your example I will help you create working example. Pie chart display the label on hover by default. https://mdbootstrap.com/snippets


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.8
  • Device: Lenevo Thinkpad
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No