2014-01-25 8 views
0

내 판매가 왼쪽 y 축에 있고 급여가 오른쪽 y 축 (보조 축)에 선 차트로있는 GOOGLE CHARTS를 사용하여 콤보 차트를 플롯하려고합니다. 그러나 내 코드가 실행되고 있지 않습니다. 문제가있는 곳을 파악할 수 없습니다. 도와주세요. 코드의 니펫 :오른쪽에 보조 축 추가

<script type="text/javascript" src="//www.google.com/jsapi"></script> 
<script type="text/javascript"> 
    google.load('visualization', '1', {packages: ['corechart']}); 
</script> 
<script type="text/javascript"> 
    function drawVisualization() { 
    // Create and populate the data table. 
    var data = google.visualization.arrayToDataTable([ 
     ['Employee ID', 'Sales', 'Salary'], 
     ['7000234', 560024, 9765], 
     ['7000260', 1180800, 15621], 
     ['7000262', 244308, 9212], 
     ['7000273', 390912, 8650], 
     ['7000288', 870445, 6692] 
    ]); 

    // Create and draw the visualization. 
    var ac = new google.visualization.ComboChart(document.getElementById('visualization')); 
    ac.draw(data, { 
     title : 'Sales and Salary', 
     width: 800, 
     height: 400, 
     hAxis: {title: "Employee ID"}, 
     vAxes: [ 0: {title: "Sales"}, 1: {title:"Salary"}], 
     series: { 
       0:{ type: "bars", targetAxisIndex: 0 }, 
       1: { type: "line", targetAxisIndex: 1} 
      }, 
    }); 
    } 


    google.setOnLoadCallback(drawVisualization); 
</script> 

답변

2

이 유일한 오류 옵션 vAxes에 보인다. [...] 대신 {...}을 사용해야합니다.

vAxes: [ 0: {title: "Sales"}, 1: {title:"Salary"}], 

vAxes: { 0: {title: "Sales"}, 1: {title:"Salary"}}, 

example at jsbin

+0

감사를 참조하십시오 : 당신은 변경해야합니다. 그것은 효과가있다! :디 – user1855888

관련 문제