How to specify a size for google pie charts?
Asked Answered
U

2

10

I'm having trouble changing the size of a google pie chart that I have made. I'm trying to draw multiple pie charts with the size of each chart proportional to the total amount of data that I'm feeding it. I am aware that we are able to change the size of the div container of the chart by adding options to the chart like as follows:

var options = {width: 400, height: 300};

However, what I'm interested in, is not changing the size of the div, but of the actual pie chart itself.

Is there any way I can change the radius of the pie chart?

I've searched around and wasn't able to find anything. Here is quick paint of what I mean:

Example

As you can see, what I would like is for the div to remain on the same size but the size of the circle to change, depending on what value I feed it.

Any help is appreciated

Unwitting answered 30/3, 2017 at 23:15 Comment(0)
M
10

try the option for chartArea

e.g.

chartArea: {width: 400, height: 300}

Managua answered 31/3, 2017 at 1:6 Comment(1)
Hey sorry for late reply, somehow I don't get notifications for these replies. This isn't exactly what I was looking for (I wanted to specifically set a radius for the circle). chartArea makes the size of the pie chart reliant on the area surrounding it. I settled for this solution though, since it did help me make the pies differently sized, while being able to keep the divs the same width and height. Thank you!!Unwitting
G
7

Try the example as below http://jsfiddle.net/toddlevy/c59HH/

function initChart() {
var options = {
    legend:'none',
    width: '100%',
    height: '100%',
    pieSliceText: 'percentage',
    colors: ['#0598d8', '#f97263'],
    chartArea: {
        left: "3%",
        top: "3%",
        height: "94%",
        width: "94%"
    }
};
Ganymede answered 5/12, 2018 at 1:1 Comment(1)
Excelent. Many thanks! Question: where did you find the docs for the chart area and legend ? I'd bee looking for theseProvisory

© 2022 - 2024 — McMap. All rights reserved.