HTML5 Canvas pie chart

Even after searching Google and triple-checking my radians values, etc. I was still having trouble with this, so I have created a jsFiddle for people to play with as a live example and will post the code below as well. (Update: in the fiddle v2, stroke and labels are added also.) var canvas = document.getElementById(“can”); … Read more

Chart.js v2: How to make tooltips always appear on pie chart?

Solution for ChartJs Version > 2.1.5: Chart.pluginService.register({ beforeRender: function (chart) { if (chart.config.options.showAllTooltips) { // create an array of tooltips // we can’t use the chart tooltip because there is only one tooltip per chart chart.pluginTooltips = []; chart.config.data.datasets.forEach(function (dataset, i) { chart.getDatasetMeta(i).data.forEach(function (sector, j) { chart.pluginTooltips.push(new Chart.Tooltip({ _chart: chart.chart, _chartInstance: chart, _data: chart.data, _options: … Read more

Python matplotlib.pyplot pie charts: How to remove the label on the left side?

You could just set the ylabel by calling pylab.ylabel: pylab.ylabel(”) or pylab.axes().set_ylabel(”) In your example, plt.axes().set_ylabel(”) will not work because you dont have import matplotlib.pyplot as plt in your code, so plt doesn’t exist. Alternatively, the groups.plot command returns the Axes instance, so you could use that to set the ylabel: ax=groups.plot(kind=’pie’, shadow=True) ax.set_ylabel(”)

How to set the labels size on a pie chart

The simplest way to change the font size on a pie chart is directly via the textprops argument in the pie() function. Using the code above add it like so: ax.pie(frac, colors=colors ,labels=labels, autopct=”%1.1f%%”, textprops={‘fontsize’: 14}) That way you can just pass in a dictionary with your desired fontsize (e.g., 14). No messing around with … Read more