最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google Pie Chart does not fit the container - Stack Overflow

programmeradmin1浏览0评论

I am working with Google Chart API and have developed a pie chart with reference to Visualization: Pie Chart

Screenshot of my pie chart:-

Screenshot shows the container via firebug...

Here is the problem arises, the low opacity blue color is the container(i.e. div) in which the chart is appearing, some what it doesn't fit to that outer div in which its contained and showing some useless whitespaces, the pie chart should fit the div anyhow if my code is right...

Working on this code:-

var options_pie = {
chartArea: { left: 0, top: 0, width: "100%", height: "60%"},
colors: ['#59ea54', '#a14660', '#f3cf4a', '#16a2c2', '#ce7374', '#39ae9b'],
legend: 'none',
};

var chartPie = new google.visualization.PieChart(document.getElementById('chart_pie'));
chartPie.draw(data, options_pie);

I dont know, am i missing something or its the problem with the api?

I am working with Google Chart API and have developed a pie chart with reference to Visualization: Pie Chart

Screenshot of my pie chart:-

Screenshot shows the container via firebug...

Here is the problem arises, the low opacity blue color is the container(i.e. div) in which the chart is appearing, some what it doesn't fit to that outer div in which its contained and showing some useless whitespaces, the pie chart should fit the div anyhow if my code is right...

Working on this code:-

var options_pie = {
chartArea: { left: 0, top: 0, width: "100%", height: "60%"},
colors: ['#59ea54', '#a14660', '#f3cf4a', '#16a2c2', '#ce7374', '#39ae9b'],
legend: 'none',
};

var chartPie = new google.visualization.PieChart(document.getElementById('chart_pie'));
chartPie.draw(data, options_pie);

I dont know, am i missing something or its the problem with the api?

Share Improve this question asked Jun 7, 2013 at 12:03 SaurabhLPSaurabhLP 3,6559 gold badges41 silver badges71 bronze badges 2
  • Is it any different without the left: 0, and top: 0;? – GusRuss89 Commented Jun 7, 2013 at 12:21
  • @GusRuss89 Thanks for reply, that also tried, but no effect... – SaurabhLP Commented Jun 7, 2013 at 12:50
Add a ment  | 

1 Answer 1

Reset to default 6

Try to modify width and height, for example :

 options.chartArea = {left:0, 'width': '80%', 'height': '80%'}
发布评论

评论列表(0)

  1. 暂无评论