两个不同图表的两个工具提示
Two tool tip for two different charts
我有两个图表线和散点图。我想要两个不同的图形的两个不同的工具提示。我已经设置了一个,但我不能为另一个做。请帮帮我。
代码
this.chart = new Chart({
tooltip: {
xDateFormat: '%Y-%m-%d %H:%M',
shared: true,
},
series: [{
type: 'line',
name: 'BG',
color: '#FA8686',
pointInterval: 3600 * 1000, // one hour
data: [[1571715050000, 95],[1571729415000, 115]]
},
{
type: 'scatter',
name: 'Insulin',
pointInterval: 3600 * 1000, // one hour
data: [{x:1571715050000, y:30, tool:85},{x:1577729415005, y:30, tool:90}],
}]
})
我的散点输出
但我只希望工具值位于散点图的工具提示中。有什么办法吗?
您可以在系列级别自定义工具提示:
series: [{
...,
tooltip: {
xDateFormat: '%Y-%m-%d %H:%M',
pointFormat: '{point.x}'
},
},
{
...,
tooltip: {
xDateFormat: '%Y-%m-%d %H:%M',
pointFormat: '{point.y}'
},
}
]
现场演示: http://jsfiddle.net/BlackLabel/doqxygb9/
API参考:https://api.highcharts.com/highcharts/series.scatter.tooltip.pointFormat
我有两个图表线和散点图。我想要两个不同的图形的两个不同的工具提示。我已经设置了一个,但我不能为另一个做。请帮帮我。
代码
this.chart = new Chart({
tooltip: {
xDateFormat: '%Y-%m-%d %H:%M',
shared: true,
},
series: [{
type: 'line',
name: 'BG',
color: '#FA8686',
pointInterval: 3600 * 1000, // one hour
data: [[1571715050000, 95],[1571729415000, 115]]
},
{
type: 'scatter',
name: 'Insulin',
pointInterval: 3600 * 1000, // one hour
data: [{x:1571715050000, y:30, tool:85},{x:1577729415005, y:30, tool:90}],
}]
})
我的散点输出
但我只希望工具值位于散点图的工具提示中。有什么办法吗?
您可以在系列级别自定义工具提示:
series: [{
...,
tooltip: {
xDateFormat: '%Y-%m-%d %H:%M',
pointFormat: '{point.x}'
},
},
{
...,
tooltip: {
xDateFormat: '%Y-%m-%d %H:%M',
pointFormat: '{point.y}'
},
}
]
现场演示: http://jsfiddle.net/BlackLabel/doqxygb9/
API参考:https://api.highcharts.com/highcharts/series.scatter.tooltip.pointFormat