为什么 Google 图表的工具提示在特定情况下不能完全发挥作用?
Why does Google chart's tooltips don't fully work in specific case?
我正在使用 html 工具提示,这很奇怪,因为只有特定点才能正确显示工具提示。
我在这个配置中使用 html 工具提示:
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('number', 'Activités');
dataTable.addColumn('number', 'Niveau 1');
dataTable.addColumn('number', 'Niveau 2');
dataTable.addColumn('number', 'Niveau 3');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
var options = {
title: 'Activités journalières par niveau de difficulté',
hAxis: {title: "Activités", titleTextStyle: {color: '#333'},gridlines:{interval: 1}},
vAxis: {title: 'Progression en %'},
tooltip: {isHtml : true},
explorer: {actions :['dragToZoom','rightClickToReset' ]},
interpolateNulls: true,
animation:{duration : 2000, easing:'inAndOut', startup : true}
};
这里是发送给addRows的数据(抱歉,格式不太好),看看最后一层(niveau):
1,
20,
NaN,
NaN,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 20.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ > ,
2,
20,
NaN,
NaN,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 20.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ > ,
3,
60,
NaN,
NaN,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 60.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ >
....... LAST LEVEL:
3,
NaN,
NaN,
60,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 60.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ >
只有当先例值不为空时,工具提示才会在悬停时显示(与上一关一样)
此处必须插入的示例:
3,
60,
NaN, ???
NaN, ???
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 60.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ >
我试过'',null,'null'。不起作用
感谢您的帮助:-)
如果值为空,则没有要显示的点,因此也没有要显示的工具提示。
但您可能缺少的部分是,工具提示列角色仅应用于它后面的列。
因此,如果您想要数据 table、
中每个系列的工具提示
那么您将需要三个工具提示列。
参见What are roles?...
...column roles apply to the 'data' column preceding it, whether it is immediately before it or before the first of a consecutive group of role columns. For example, you could have two columns following a 'data' column, one for 'tooltip' and one for 'annotation'.
在发布的示例中,工具提示将仅针对列 'Niveau 3'
显示
如果您想要每个系列的工具提示,数据 table 还需要两列...
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('number', 'Activités');
dataTable.addColumn('number', 'Niveau 1');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
dataTable.addColumn('number', 'Niveau 2');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
dataTable.addColumn('number', 'Niveau 3');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
我正在使用 html 工具提示,这很奇怪,因为只有特定点才能正确显示工具提示。
我在这个配置中使用 html 工具提示:
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('number', 'Activités');
dataTable.addColumn('number', 'Niveau 1');
dataTable.addColumn('number', 'Niveau 2');
dataTable.addColumn('number', 'Niveau 3');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
var options = {
title: 'Activités journalières par niveau de difficulté',
hAxis: {title: "Activités", titleTextStyle: {color: '#333'},gridlines:{interval: 1}},
vAxis: {title: 'Progression en %'},
tooltip: {isHtml : true},
explorer: {actions :['dragToZoom','rightClickToReset' ]},
interpolateNulls: true,
animation:{duration : 2000, easing:'inAndOut', startup : true}
};
这里是发送给addRows的数据(抱歉,格式不太好),看看最后一层(niveau):
1,
20,
NaN,
NaN,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 20.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ > ,
2,
20,
NaN,
NaN,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 20.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ > ,
3,
60,
NaN,
NaN,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 60.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ >
....... LAST LEVEL:
3,
NaN,
NaN,
60,
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 60.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ >
只有当先例值不为空时,工具提示才会在悬停时显示(与上一关一样)
此处必须插入的示例:
3,
60,
NaN, ???
NaN, ???
Rubrique: < b > La proportionnalité < /b><br/ > Progression: < b > 60.00 % < /b><br/ > Temps: < b > 120 secondes < /b><br/ > Date: < b > 16.07 .2020 < /b><br/ >
我试过'',null,'null'。不起作用
感谢您的帮助:-)
如果值为空,则没有要显示的点,因此也没有要显示的工具提示。
但您可能缺少的部分是,工具提示列角色仅应用于它后面的列。
因此,如果您想要数据 table、
中每个系列的工具提示
那么您将需要三个工具提示列。
参见What are roles?...
...column roles apply to the 'data' column preceding it, whether it is immediately before it or before the first of a consecutive group of role columns. For example, you could have two columns following a 'data' column, one for 'tooltip' and one for 'annotation'.
在发布的示例中,工具提示将仅针对列 'Niveau 3'
如果您想要每个系列的工具提示,数据 table 还需要两列...
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('number', 'Activités');
dataTable.addColumn('number', 'Niveau 1');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
dataTable.addColumn('number', 'Niveau 2');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});
dataTable.addColumn('number', 'Niveau 3');
dataTable.addColumn({type: 'string', role: 'tooltip', p:{html:true}});