How to display label and data on pie chart using angular charts - javascript

Hi How to always display tooltips on pie chart using angular chart.
I'm trying using this part of code:
$scope.options = {
showToolTips: true,
tooltipEvents: [],
onAnimationComplete: function() {
this.showTootip(this.datasets[0].bars,true);
},
tooltips: {
backgroundColor: "transparent"
}
};
But it doesn't work. Here is my example of chart. https://jsfiddle.net/vz4qhqpw/115/

Related

Chartjs: Align pie chart to the left

Im currently developing a Pie Chart with ChartJS (3.9.1) and react-chartjs-2 wrapper,
my chart is using full-width.
I want my chart to stick to the left side, to be able to show more than 12 options. How can I stick the Pie Chart to the left? I've tried using padding:0 already (ref. config).
My options config for the Pie Chart is:
const optionsPie = {
responsive: true,
maintainAspectRatio: false,
layout: {
padding: {
left: 0,
right: 0,
},
},
plugins: {
legend: {
position: 'right' as const,
},
},
};

Is there a way to display legend's data over the chart in chart.js?

I've created a pie chart using the chart.js and react-chartjs-2 library but I was wondering if there is a way to display the data over the chart component and not as a tooltip while hovering about each area of the pie chart
What I wanted to do is display the data related to each area over itself, like on top of it.
The options can be added while creating new chart
var pieChart = new Chart(canvas, {
type: "pie",
data: data,
options: {
legend: {
display: true,
position : 'top'
},
tooltips: {
enabled: false
}
}
});

Removing legend from chart.js Radar chart

I am using the Radar chart from Chart.js and I want to hide the legend(label) I did this:
new Chart("myChart", {
type: "radar",
data: data,
options: {
legend:{
display: false,
},
}
});
But is not working for some reasons also checked those:
Removing legend on charts with chart.js v2
Removing legend on charts with chart.js v2
I'm doing the same but not working
As described in the migration guide (https://www.chartjs.org/docs/master/getting-started/v3-migration.html#specific-changes) the legend has been moved to the plugins namespace so you will need to put it like so:
new Chart("myChart", {
type: "radar",
data: data,
options: {
plugins: {
legend: {
display: false,
},
}
}
});

Why the draggable plugin does not work for a radar chart in ChartJS?

Currently I am building a frontend application, that uses data like AirQuality and information about POIs. For displaying the rating of the single points I am using a radar chart with ChartJS (using it the First Time ever!).
I can already change the chart with input data, that is pushed to the chart after a button click. Another functionality I wanted to implement is the possibility to drag the endpoints of the radar chart to change the values.
I found the draggable plugin and I have tried to implement it, but it does not work like I thought it would.
This is the first time I am working with chartJS and I have found myself confused with the documentation about the plugin.
I am using plain JavaScript. No frameworks at all.
Here is the code for my chart:
var data = {
labels: ["Air", "POI", "Noise"],
datasets: [{
backgroundColor: "#50237f",
borderColor: "#50237f",
data: [33.3333333333, 33.3333333333, 33.3333333333],
label: 'Rating'
}]
};
var options = {
scale: {
ticks: {
min: 0,
max: 100,
stepSize: 25,
showLabelBackdrop: false
}
},
maintainAspectRatio: true,
spanGaps: false,
elements: {
line: {
tension: 0.000001
}
},
};
var ctx = document.getElementById("ratingChart");
var myChart = new Chart(ctx, {
type: 'radar',
data: data,
options: options,
config: {
plugins: {
// maybe set the plugin here? but how?
}
}
});

How to set plot options in Highcharts in case of drill down

I have just started using Highchart in my project and I am very much new to it.
I am stuck with two scenarios for drill down charts:
First I need to show a column chart, and on click of the column I have to show a pie chart with legends. I am looking on below example:jsfiddle
legend: {
enabled: true
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
format: '{point.y:.1f}%'
}
},
showInLegend: true
},
Second I have requirement to show drill down to three levels: Column chart to Column chart to Column Stacked Chart. I have not been able to find out a way to set the plotOptions correctly to achieve this.
Thanks in advance.

Categories

Resources