It seems as though support for edge labels in the Force Directed Graph Viz is currently half-baked. The code in visualizations.js seems to use a line_label field emitted from the search results to label the edges, but fails to add this data to the entries in linksArray (which contains only target, source, and optionally, count). Thus when trying to label the nodes the lookup returns undefined and the label isn't used.
Could someone let me know if I am reading the code correctly? Is there a work-around for this issue? If not what is the process to get this fixed? I'm happy to make the change myself if someone provides me with instructions.
datum.forEach(function (link) {
group_id = 0;
// Create a link object to push the target and source to the linksArray array.
object = {};
object.target = nodeByName(link[0], group_id);
object.source = nodeByName(link[1], group_id);
object.count = link[2];
// Push the nodes to the nodesByName array including a group id of 0.
// Push the object dictionary item from lines above to the linksArray array
linksArray.push(object);
});
// If there is a field named line_label in the Splunk results
if (headers.line_label) {
// Set the line_label variable to the number in the field
line_label = Number(headers.line_label);
} else {
line_label = "False";
}
// Create edge labels for labels on paths to exist
edgelabels = svg.selectAll(".edgelabel")
.data(linksArray)
.enter()
.append('text')
.style("pointer-events", "none")
.attr('class', 'edgelabel')
.attr('id', function (d, i) {
return 'edgelabel' + i
})
.attr('font-size', 10)
.attr('fill', stringFill)
.on("mouseover", fade(.1)).on("mouseout", fade(1));
// Append text to the edge labels
edgelabels.append('textPath')
.attr('xlink:href', function (d, i) {
return '#edgepath' + i
})
.style("text-anchor", "middle")
.style("pointer-events", "none")
.attr("startOffset", "50%")
.text(function (d) {
return d[line_label]
});