Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizMobile Technologies Mobile Computing 2 years ago
Posted on 16 Aug 2022, this text provides information on Mobile Computing related to Mobile Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Mobile Technologies 1 Answers
Mobile Technologies 0 Answers
Mobile Technologies 0 Answers
Mobile Technologies 0 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.
manpreet
Best Answer
2 years ago
_x000D_ In order to do this in chart.js, you need to use the tooltips.callbacks.label callback property. The value returned from this callback is what is used to generate the tooltip text. Here is your chart configured with a tooltip callback that uses the local string representation for your data value. var ctx = document.getElementById("chart-area").getContext("2d"); var myPie = new Chart(ctx, { type: 'pie', data: { labels: ["FAISAL","muhammadfaisali","faisaliqbal3699"], datasets: [{ backgroundColor: ["#00b638","#efaa30","#50c8ea"], data: [500000, 75000, 100000] }], }, options: { title: { display: true, text: 'Employee Overview', fontStyle: 'bold', fontSize: 20 }, tooltips: { callbacks: { // this callback is used to create the tooltip label label: function(tooltipItem, data) { // get the data label and data value to display // convert the data value to local string so it uses a comma seperated number var dataLabel = data.labels[tooltipItem.index]; var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index].toLocaleString(); // make this isn't a multi-line label (e.g. [["label 1 - line 1, "line 2, ], [etc...]]) if (Chart.helpers.isArray(dataLabel)) { // show value on first line of multiline label // need to clone because we are changing the value dataLabel = dataLabel.slice(); dataLabel[0] += value; } else { dataLabel += value; } // return the text to display on the tooltip return dataLabel; } } } } }); You can see it in action at this codepen.