选择React中Google图表上的工具提示显示的信息

问题描述

我已经通过反应制作了一个散点图,但是我想更改工具提示显示的数据。散点图显示以下数组,所以我不能只添加像这样的新列( { role: "tooltip",type: "string",p: { html: true } )

0: (10) ["Day",{…},{…}]
1: (10) ["03",null,50,null]
2: (10) ["04",40,null]
3: (10) ["05",null]

0位置包含此信息:

0: "Day"
1: {type: "number",label: "Consult"}
2: {type: "number",label: "Medication"}
3: {type: "number",label: "Rescue"}
4: {type: "number",label: "Urgency"}
5: {type: "number",label: "Others"}
6: {type: "number",label: "Event"}
7: {type: "number",label: "Symptom"}
8: {type: "number",label: "High consumption"}
9: {type: "number",label: "Crisis"}

此“重要事件”中的每个事件都有一个值,因此可以将其显示在图形上,如下所示:

Graph image

工具提示显示如下:

Graph tooltips

问题是我想控制工具提示中的信息,或至少删除“重要事件” (在图像中为40,对应的Urgencia值(“紧急”),因此显示为:Urgencia 04。

这也是图表代码

                   <Chart
                    chartType="ScatterChart"
                    loader={<div>Loading Chart</div>}
                    data={ data}
                    options={{
                        colors: pointColors,width: chartWidth,height: 160,position:true,backgroundColor:{
                            strokeWidth:0
                        },chartArea: {
                            top: 10,height: height,width:'85%',right: 0,left: 40,},isstacked: stacked,tooltipFontSize: 15,legend: { position: 'none',fontSize:13,italic: false },vAxis: {
                             gridlines: {
                                color: 'transparent',ticks: ticks,titleTextStyle: { 
                                fontSize:5,italic: false,textStyle:{
                                fontSize: 5
                            }
                          },hAxis:{
                            minValue: 0,slantedText: false,textStyle: {
                                fontSize: 12
                            }
                        },annotations:{
                            textStyle: {
                                fontName: 'Times-Roman',fontSize: 13,bold: true,}
                        }
                    }}
                    rootProps={{ 'data-testid': '1' }}  
                   />

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)