2016-10-02 5 views
1

가로 막 대형 차트 (막대가 세로 대신 가로로 표시됨)의 경우를 제외하고는 this question에 설명 된 것과 동일한 작업을 수행하고 싶습니다. 여기 그 질문에서 이미지를 복사 할 수 있습니다 :누적 가로 막 대형 차트에 세로 줄 추가

enter image description here

내가 수직선이 비슷한 스택 수평 막대 차트를 가지고 싶습니다.

ComboCharts은 가로 막 대형 차트를 지원하지 않으므로 다른 방법이있을 수 있기를 바랍니다.

답변

1

열 차트

이 작업 조각을 다음을 참조 막대 차트가되도록 축을 회전합니다 orientation: 'vertical'를 사용하여 ...

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>

+0

감사합니다, 나는에 있음을 결합 할 수 있습니다 링크 된 질문에 대답하면 전체 너비 줄을 얻을 수도 있습니다. –

관련 문제