The calculation for determining bar widths is complex (I wrote up a rough 
estimation here: http://stackoverflow.com/a/24825504/613559).  Assuming all 
of your x-axis values are evenly spaced (or you are using a discrete axis) 
and you have the bar.groupWidth option set to '100%', each row needs a 
minimum of 1 pixel per data series, and you probably need padding for the 
y-axis values as well.  You may want to do something like this:

var leftPad = 50;
var rightPad = 10;
var factor = 3;
var width = Math.max(800, (rows * factor) + leftPad + rightPad);
var barGroupWidth = (width > 800) ? '100%' : null;

combo = new google.visualization.ChartWrapper({
    chartType: 'ComboChart',
    containerId: 'chart1',
    options: {
        chartArea: {
            left: leftPad,
            width: width - leftPad - rightPad
        },
        width: width,
        bar: {
            groupWidth: barGroupWidth
        }
    }
});

On Thursday, August 7, 2014 10:56:22 AM UTC-4, qdkid wrote:
>
> When the chart width can't hold all the datatable->rows, the chart simply 
> cuts off. I am trying to make the chart width dynamic based on the row 
> number.  Is there a minimum width for each bar?
> Ie  
> <script>
> ....
>
> var rows = datatable.getNumberOfRows ();
> var factor= 3;
> var width = Math.max (800, rows * factor);
> ...
> combo =  new google.visualization.ChartWrapper({
>           'chartType': 'ComboChart',
>           'containerId': 'chart1',
>           'options': {
> ....
>         width: width,
> .....
> </script>
>
> how do I decide a good value of "factor"
>
> Thank you.
>
>
>
>

-- 
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