2013-02-11 2 views
2

Google 막대 차트에서 툴팁을 사용하려고하는데 내 데이터 테이블의 맨 위 행에 no가 있으면 내 툴팁이 작동하는 이상한 문제가 발생합니다. 그것의 툴팁.Google Charts 툴팁은 툴팁이없는 첫 번째 행에서만 작동합니다.

나는이 작업을 수행 할 때 차트를 렌더링하지 않습니다 그 여분의 행 차종을 추가하는 이유

function drawVisualization() { 
    // Create and populate the data table. 
    var data = google.visualization.arrayToDataTable([ 
    ['Report','Ineffective', 'Developing', 'Effective', 'Highly Effective'], 
    ['Growth Rating',{v:18, f:'tooltip text'},{v:12, f:'tooltip text'},{v:66, f:'tooltip text'},{v:4, f:'tooltip text'}], 
    ['Composite Rating',{v:6, f:'tooltip text'},{v:12, f:'tooltip text'},{v:58, f:'tooltip text'},{v:25, f:'tooltip text'}] 
    ]); 

    // Create and draw the visualization. 
    new google.visualization.BarChart(document.getElementById('chart_div')). 
     draw(data, 
     {title:"TITLE", 
     colors: ['#638FBC','#FFE17C','#FFA87C','#204C7A'], 
     hAxis: {title: "Percent of Educators", viewWindow:{max:105, min:0}, titleTextStyle: {italic: false}}, 
     chartArea: {width: "60%"}, 
     isStacked: true} 
    ); 
} 

을하지만 이렇게하면 차트가 잘 렌더링

function drawVisualization() { 
    // Create and populate the data table. 
    var data = google.visualization.arrayToDataTable([ 
    ['Report','Ineffective', 'Developing', 'Effective', 'Highly Effective'], 
    ['Empty', 0 , 0 , 0 , 0 ], 
    ['Growth Rating',{v:18, f:'tooltip text'},{v:12, f:'tooltip text'},{v:66, f:'tooltip text'},{v:4, f:'tooltip text'}], 
    ['Composite Rating',{v:6, f:'tooltip text'},{v:12, f:'tooltip text'},{v:58, f:'tooltip text'},{v:25, f:'tooltip text'}] 
    ]); 

    // Create and draw the visualization. 
    new google.visualization.BarChart(document.getElementById('chart_div')). 
     draw(data, 
     {title:"TITLE", 
     colors: ['#638FBC','#FFE17C','#FFA87C','#204C7A'], 
     hAxis: {title: "Percent of Educators", viewWindow:{max:105, min:0}, titleTextStyle: {italic: false}}, 
     chartArea: {width: "60%"}, 
     isStacked: true} 
    ); 

난 몰라 그것은 작동합니다.

도움을 주시면 감사하겠습니다.

답변

1

이는 arrayToDataTable의 {v :, f :} 셀에 대한 지원이 현재 다소 불규칙하기 때문입니다. 우리는 라이브러리의 다음 버전에서이를위한 수정 사항을 게시 할 것입니다. 그 동안 google.visualization.DataTable 생성자를 다음과 같이 사용할 수 있습니다.

var data = new google.visualization.DataTable(); 
data.addColumn('string', 'Report'); 
data.addColumn('string', 'Developing'); 
data.addColumn('string', 'Effective'); 
data.addColumn('string', 'Highly Effective'); 
data.addRows([ 
    ['Growth Rating',{v:18, f:'tooltip text'},{v:12, f:'tooltip text'},{v:66, f:'tooltip text'},{v:4, f:'tooltip text'}], 
    ['Composite Rating',{v:6, f:'tooltip text'},{v:12, f:'tooltip text'},{v:58, f:'tooltip text'},{v:25, f:'tooltip text'}] 
]); 
+1

나는이 두 번 upvote 수 :) – Novarg

관련 문제