1

I'd like to do the same thing described in this question, except that I want to do it for a horizontal bar chart (the bars are horizontal instead of vertical). I'll copy the image from that question here:

enter image description here

I'd like to have a stacked horizontal bar chart similar to this with a vertical line.

It seems that ComboCharts doesn't support horizontal bar charts so I was hoping there might be another way.

0

1 Answer 1

1

using orientation: 'vertical' will rotate the axes so that a column chart becomes a bar chart

see following working snippet...

google.charts.load('current', { callback: function () { var container = document.getElementById('chart_div'); var chart = new google.visualization.ComboChart(container); var data = google.visualization.arrayToDataTable([ ['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General', 'Western', 'Literature', 'Minimum', 'Maximum'], ['2010', 10, 24, 20, 32, 18, 5, 90, 140], ['2020', 16, 22, 23, 30, 16, 9, 90, 140], ['2030', 28, 19, 29, 30, 12, 13, 90, 140] ]); var options = { bar: { groupWidth: '75%' }, height: 400, isStacked: true, legend: { position: 'bottom' }, orientation: 'vertical', series: { 6: { color: '#000000', type: 'line' }, 7: { color: '#000000', type: 'line' } }, seriesType: 'bars', width: 600, }; chart.draw(data, options); }, packages: ['corechart'] });
<script src="https://www.gstatic.com/charts/loader.js"></script> <div id="chart_div"></div>

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I can combine that with the answer in the linked question to get the full width line as well.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.