我正在尝试在谷歌条形图中使用工具提示,并且遇到了一个奇怪的问题,我的工具提示仅在我的数据表的第一行没有工具提示时才有效。
当我这样做时,图表不会呈现:
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}
);
我不知道为什么添加额外的行使它起作用。
任何帮助将不胜感激。