Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a size for google pie charts?

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

like image 822
L. Chen Avatar asked Mar 30 '17 23:03

L. Chen


2 Answers

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%"
    }
};
like image 102
Shailesh Tiwari Avatar answered Oct 21 '22 12:10

Shailesh Tiwari


try the option for chartArea

e.g.

chartArea: {width: 400, height: 300}

like image 10
WhiteHat Avatar answered Oct 21 '22 10:10

WhiteHat