๐คย Diwas Poudel ย ย  ๐ 27 May 2023 ย ย  ๐ FIX

Google Sheets is a powerful free tool provided by Google which helps to plot your data into colorful charts and graphs. So that we can analyze the different information quickly. Google Sheets provides different types of charts like bar charts, pie charts, line charts, histograms, and many more.

Piecharts are statistical graphs in which a circle is divided into slices(ie. sections) to represent values of relative sizes of data.

Here, In the example, we are using one simple table and generated pie charts showing data on expenses and savings of income. We assume that you already know to create a pie chart. And its default generated pie charts look like this.

Also, read:ย How to use if a cell contains in google sheets?ย

This shows the only percentage in the piecharts and now you want to get value instead of this then follow these steps.

Working with Google Sheets version :

1 First click on the piechart

2 Click on 3 dots in the top right corner of the Pie Charts

3 Click on Edit Chartย

4 Click on Customize panel

5 Expand the Pie chart section.

6 Under the slice label dropdown select 'value'

Now your pie chart looks like this.

Suppose you want both number and percent in a pie slice then just select "Value and Percentage" from the Slice label as shown below.

### Using Google Scripts to change Slice Level to number

Suppose you have generated Pie Chart using Google Apps Script or by Insert > Chart then it will not display any label.

The script for Generating Pie Chart looks like this:

```function createPieChart() {
var sheet = ss.getSheets()[0];

var chart = sheet.newChart()
ย  ย  .setChartType(Charts.ChartType.PIE)
ย  ย  .setPosition(5, 20, 0, 0)
ย  ย .build();
sheet.insertChart(chart);
}```

Note that F3:G10 is the value range and the setChartType() function accepts the type of the chart as a parameter. Here, we have mentioned Pie. And setPosition() will set the position of the chart and finally build() function is called which will build the piechart and then insertChart() function is called which binds the chart to the google sheet.ย

Just insert one line as shown below

.setOption('pieSliceText', 'value')

Complete Google App Script looks like this:

```function createPieChart() {
var sheet = ss.getSheets()[0];

var chart = sheet.newChart()
.setChartType(Charts.ChartType.PIE)
.setOption('pieSliceText', 'value')
.setPosition(5, 20, 0, 0)

.build();

sheet.insertChart(chart);
}
```

### How to adjust the font size of numbers in pie chart labels?

You can do the following to adjust the font size of numbers in pie chart labels:

1. First, select the pie chart you want to adjust the font size.
2. Click on the "Customize" tab
3. Click on the "Slice label" dropdown under "Piechart".
4. Select the "Custom" option
5. You can change the font, size, and color of slice labels under "Slice label formatting"
6. Click on "Save"

Changing this label format will affect the readability and clarity of your piechart.

Conclusion:

In this article, we explain two approaches for converting piechart percentages to numbers; nevertheless, the first method, in which we set the "pieSliceText" option to "value," is the method that I find most useful. The second one is useful if you are generating Piechart using Google Script.

ย

๐ค 08 Jan 2024

๐ค 07 Jan 2024

๐ค 04 Jan 2024

๐ค 02 Jan 2024

๐ค 01 Jan 2024

๐ค 01 Jan 2024

๐ค 19 Dec 2023

๐ค 03 Dec 2023

๐ค 28 Nov 2023

๐ค 14 Nov 2023

๐ค 14 Nov 2023

๐ค 09 Nov 2023

๐ค 06 Nov 2023

๐ค 06 Nov 2023

๐ค 01 Nov 2023

๐ค 25 Oct 2023

๐ค 25 Oct 2023

๐ค 16 Sep 2023