All Apps and Add-ons

Support for edge labels in Splunk Force Directed Viz

bsykes10
New Member

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]
              });
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...