Use ColumnChart instead of BarChart, or just add the orientation:
'horizontal' option.

On Tue, Jul 5, 2016 at 2:07 PM, Michael X <[email protected]> wrote:

> hi
>
> how can i switch the axis in stacked chart  , for example :
>
> need to draw   population on Y axis instead of X.
>
>
> google.charts.load('current', {packages: ['corechart', 'bar']});
>
> google.charts.setOnLoadCallback(drawStacked);
>
>
> function drawStacked() {
>
>       var data = google.visualization.arrayToDataTable([
>
>         ['City', '2010 Population', '2000 Population'],
>
>         ['New York City, NY', 8175000, 8008000],
>
>         ['Los Angeles, CA', 3792000, 3694000],
>
>         ['Chicago, IL', 2695000, 2896000],
>
>         ['Houston, TX', 2099000, 1953000],
>
>         ['Philadelphia, PA', 1526000, 1517000]
>
>       ]);
>
>
>       var options = {
>
>         title: 'Population of Largest U.S. Cities',
>
>         chartArea: {width: '50%'},
>
>         isStacked: true,
>
>         hAxis: {
>
>           title: 'Total Population',
>
>           minValue: 0,
>
>         },
>
>         vAxis: {
>
>           title: 'City'
>
>         }
>
>       };
>
>       var chart = new google.visualization.BarChart(document
> .getElementById('chart_div'));
>
>       chart.draw(data, options);
>
>     }
>
>
> thanks
> Michael
>
> --
> 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
> https://groups.google.com/group/google-visualization-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/1b32882b-2670-407f-a091-eba912c74282%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/1b32882b-2670-407f-a091-eba912c74282%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJN5BPJ6tY2my1f9DADBf9%2BV1jg-D%2BgEra1mLcLtQxMNnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to