gpt4 book ai didi

javascript - 当鼠标悬停在每个节点上时带有工具提示的 Highchart 网络图

转载 作者:行者123 更新时间:2023-11-28 17:05:22 29 4
gpt4 key购买 nike

我正在使用 highcharts 为我的一个 Angular 项目创建网络图。我想在鼠标移动到点/节点时创建工具提示。我尝试使用下面的图表选项进行创建。但是,我收到错误。如何为网络图点创建工具提示?

 chartOptions = {
chart: {
type: "networkgraph",
height: "100%"
},
title: {
text: "Network graph demo"
},
subtitle: {
text: "A Force-Directed Network Graph in Highcharts"
},
plotOptions: {
networkgraph: {
keys: ["from", "to"],
layoutAlgorithm: {
enableSimulation:true
}
}

},
series: [
{
dataLabels: {
enabled: true,
linkFormat: ''
},
data: [{from : 'a', to: 'b'},
{from: 'a', to: 'c'},
{from: 'a', to: 'd'} ],
marker : {radius : 18}
}

],
tooltip :
{
enabled : true,
formatter : { function() {
return "<div> <span> My tooltip information </span> </div>"
}}
}
}

错误:

 ERROR TypeError: w.call is not a function
at a.Tooltip.refresh (highcharts.js:205)
at a.Pointer.runPointActions (highcharts.js:220)
at q.onMouseOver (highcharts.js:446)
at SVGGElement.d [as __zone_symbol__ON_PROPERTYmouseover] (highcharts.js:435)
at SVGGElement.wrapFn (zone.js:1332)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)

最佳答案

工具提示似乎错误。 (额外的大括号)

试试这个代码:

 tooltip :
{
enabled : true,
formatter : function() {
return "<div> <span> My tooltip information </span> </div>"
}
}

关于javascript - 当鼠标悬停在每个节点上时带有工具提示的 Highchart 网络图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55995371/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com