Hi...

I'm attempting to make the charts in my page responsive. But I'm having a 
problem getting both charts to resize. In my code below, just the second 
chart resizes properly using: window.onresize = function(){chart.draw(data, 
options);};


<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script type="text/javascript">

       google.load('visualization', '1', {'packages': ['annotatedtimeline', 
'corechart']});
       google.load("visualization", "1", {packages: ["corechart"]});


 google.setOnLoadCallback(drawChart);

    function drawChart() {

         var data = google.visualization.arrayToDataTable([
              ['Index', 'FFIUS', 'S&P 500'],
              ['10 Yrs', .768, .699],
              ['5 Yrs', .923, .846],
              ['3 Yrs', .712, .637],
              ['1 Yr', .129, .114],
              ['YTD', .129, .114],
              ['6 Mos', .067, .050],
              ['3 Mos', .055, .044],
              ['1 Mo', -.003, -.004]
           ]);

        var options = {
             chart: {bars: 'horizontal'},
             backgroundColor: { fill: '#f0f0f0' },
             colors: ['#1F4E79','#ADB9CA'],
             chartArea: { backgroundColor: '#f0f0f0', height:'80%', width: 
'80%', left: 50, top: 0},
             legend: {textStyle: {fontName: 'Calibri', fontSize: 12, bold: 
true}, alignment: "center", position: "bottom"},
             bar: {groupWidth: "90%"},
             vAxis: {textStyle: {fontName: 'Calibri', fontSize: 11,bold: 
true}},
             hAxis: {textStyle: {fontName: 'Calibri', fontSize: 11,bold: 
true}, format: '#%', viewWindowMode: 'explicit',   viewWindow: {min: -0.05,
max:1.00}}
          };

        var chart = new google.visualization.BarChart(document.
getElementById('ffius-creturns'));

            chart.draw(data, options);
            window.onresize = function(){chart.draw(data, options);};  

     }

google.setOnLoadCallback(drawChart2);
            
     function drawChart2() {

           var data = google.visualization.arrayToDataTable([
                ['Index', 'FFIUS', 'S&P 500'],
                ['2005',.0250,.0300],
                ['2006',.1310,.1362],
                ['2007',.203,.353],
                ['2008',-.3903,-.3849],
                ['2009',.2751,.2345],
                ['2010',.1347,.1278],
                ['2011',-.0102,-.001],
                ['2012',.1525,.1341],
                ['2013',.3158,.2960],
                ['2014',.1288,.1139]
            ]);

          var options = {
                chart: {bars: 'vertical'},
                backgroundColor: { fill: '#f0f0f0' },
                colors: ['#1F4E79','#ADB9CA'],
               chartArea: { backgroundColor: '#f0f0f0', height:'80%', width: 
'90%', left: 30, top: 5},
               legend: {textStyle: {fontName: 'Calibri', fontSize: 12, bold: 
true}, alignment: "center", position: "bottom"},
               bar: {groupWidth: "90%"},
               vAxis: {textStyle: {fontName: 'Calibri', fontSize: 11,bold: 
true}, format: '#%'},
               hAxis: {textStyle: {fontName: 'Calibri', fontSize: 10,bold: 
true},  viewWindowMode: 'explicit'}
            };

                var chart = new google.visualization.ColumnChart(document.
getElementById('ffius-areturns'));

                chart.draw(data, options);
                window.onresize = function(){chart.draw(data, options);};

            }

 </script>



Appreciate help on getting both charts to resize. Thanks, Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to