twitter-bootstrap


Google Charts overflow with Bootstrap


I have been working on a dashboard using Bootstrap and Google Charts. I have a problem where the charts overflow. I first noticed the problem on pages where all the content doesn't fit on the screen and the vertical scroll bar appears. After the page loads, if I re-size the browser window, then the charts re-draw and everything looks good. How can I work around this issue?
I have included a sample of the code with the area chart that appears in the picture:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Site1.com Analytics</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
// Load the Visualization API and the chart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart_google_user_count);
function drawChart_google_user_count() {
var json = $.ajax({
url: 'google_analytics_user_count_data.php', // make this url point to the data file
dataType: 'json',
async: false
}).responseText;
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(json);
var options = {
height: 300,
chartArea: {width: '98%', height: '80%'},
hAxis: {showTextEvery: 7, textStyle: {fontSize: '10'}},
legend: {position: 'top', textStyle: {color: 'blue', fontSize: 12}},
lineWidth: 4,
pointShape: 'circle',
pointSize: 6,
vAxis: {textPosition: 'in', gridlines: {count: 3}, minorGridlines: {count: 2}, textStyle: {fontSize: 12}},
};
// Instantiate and draw our chart, passing in some options.
//do not forget to check ur div ID
var chart = new google.visualization.AreaChart(document.getElementById('chart_div_google_user_count'));
chart.draw(data, options);
}
$(window).resize(function(){
drawChart_google_user_count();
})
</script>
</head>
<body>
<div class="container-fluid">
<div class = "row voffsetpercent">
<div class = "col-md-12">
<div class = "chart-title">Visitors Per Day</div>
<div id="chart_div_google_user_count"></div>
</div>
</div>
</div>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
I set a height in px on each of the div tags containing a chart like so:
<div id="chart_div_google_user_count" style="height:300px;"></div>
This seems to clear up the chart from overflowing the div on initial loading of the page.

Related Links

Change div rows order in bootstrap 3
Bootstrap navbar-collapse not dropping on mobile
Inline form vertical spacing issue
Embedded video shows a totally other video
Customizing spree e-commerce view
bower install bootstrap-saas giving ENOTFOUND error
Bootstrap button not working in Internet Explorer
Hide Bootsrap modal in mobile
Bootstrap Datetimepicker issue occured
Combine 2 streams
Bootstrap 3 affix offset-bottom behaviour
How can I remove the prev and next button in datatable bootstrap pagination if there's only one or two pages?
How can I highlight table cells that have been edited and those that are updated as a result?
Working with meteor wizard steps?
icon-youtube didn't work in bootstrap
Bootstrap 2.2.2 button dropdown toggle instantly closes on iOS

Categories

HOME
azure-active-directory
marie
alasql
service
customization
symfony-sonata
schema
wavefront
rtc
rename
spring-data-solr
jcodemodel
urllib2
distinct
websharper
chef-recipe
react-select
brightway
amazon-data-pipeline
hapijs
bug-reporting
ajaxcontroltoolkit
angular2-pipe
v4l2
android-wear-2.0
mongoose-im
spring-data-gemfire
concrete5
unity3d-5
circle
ports
webclient
certbot
cocoa-scripting
queryover
origami
mediastream
usernotifications
observer-pattern
idea-plugin
delphi-xe
jvisualvm
google-cloud-powershell
collation
rexx
text-extraction
head
cakephp-3.2
codepen
taleo
reqif
anonymous-function
hierarchical-clustering
xmldom
monaca
multivalue
photoshop-script
openpgp.js
activesupport
acceleo
huawei
blitz3d
class-design
mate-desktop
hfp
diameter-protocol
camellia
stdlist
calc
wordpress-plugin
personality-insights
bootstrap-tabs
roslyn-code-analysis
p4python
litedb
pdcurses
stereotype
grails-3.0.9
genome
httpmodule
chunks
fiware-health
uiblureffect
breeze-sharp
tigase
redmine-plugins
windows-search
serializer
dateadd
winrun4j
xps
git-subtree
autofilter
fade
sygic
ie-developer-tools
typography
qmainwindow
gpl
quit
mail-gem
expresso-store
netbiscuits
shapado
blackberry-eclipse-plugin
code-organization
cherokee
log-shipping
jquery-click-event
jqtransform
text-manipulation
chromebug
carbon-emacs
jgrowl
office-2003
memory-consumption

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile