问题
i'm trying to implement a network graph, and in my case the edges must be labeld. For example, i'm fetching data like this
[{from: "A", to: "B", "label":"text1"},{from: "B", to: "C", "label": "text2"}]
so in the graph it must be like this: A-----text1------B--------text2--------C
I've read the docs and there's the linkFormatter that can help me do this but i can't figure it out. I've tried to memic this question's answer highchart network network-graph that shows label on tooltip not the edges. Can please someone help me !!
回答1:
Use linkFormat
or linkFormatter
with the correct reference to the property, for example:
series: [{
...,
dataLabels: {
enabled: true,
allowOverlap: true,
linkFormat: '{point.label}'
},
}]
Live demo: https://jsfiddle.net/BlackLabel/jfbwLhp3/
API Reference: https://api.highcharts.com/highcharts/series.networkgraph.dataLabels.linkFormatter
来源:https://stackoverflow.com/questions/62493387/highcharts-network-graph-custom-link-labels