Giter Club home page Giter Club logo

sankey's Introduction

Sisense Sankey widget

This source repo has a copy of the Sankey widget released by Sisense developer, Eli. The reference can be found [here] (https://support.sisense.com/entries/45935590-Sankey-diagram-custom-widget).

The Sankey widget is a d3.js widget that is wrapped in Sisense widget code. Accordingly, the code's operation can be viewed within a purely web environment (HTML + CSS + javascript) or within the Sisense environment.

The code has been updated to version 3.5.16 of d3.min.js. In addition, there are fixes from the d3.js repo for rendering data with cycles.

data/

This directory has sample data to use with a Sisense data cube.

src/

This directory has the source code for the Sisense widget.

sankey's People

Contributors

hughdbrown avatar

Watchers

 avatar James Cloos avatar  avatar

sankey's Issues

Sisense widget has odd display for cycles

The d3.js widget displays cycles with a flow across the top of the diagram. This can be seen clearly with the pure d3.js and HTML rendering in src/test.html.

screen shot 2016-02-22 at 10 00 09

However, the same data rendered in a Sisense context shows some odd clipping.

screen shot 2016-02-22 at 09 55 40

Add clickable event to sankey diagram path to implement source/target selection

To filter on filter on source and target in the Sisense sankey widget, we need to be able to click on the svg path element.

This Stackoverflow question addresses attaching a click event to a path. It amounts to making sure the DOM element is findable (in this case, using a unique CSS ID).

This code:

  var link = allgraphics.append("g").attr("id", "link-container")
      .selectAll(".link")
      .data(energy.links)
    .enter().append("path")
      .attr("class", function(d) { return (d.causesCycle ? "cycleLink" : "link") })
      .attr("d", path)
      .sort(function(a, b) { return b.dy - a.dy; });

makes clear that the nodes have CSS class of link or cycleLink when they connect two nodes, so this code:

  var click_path = function(d) {
    if (d3.event.defaultPrevented) return; // click suppressed
    console.log("clicked " + d.name + "!");
  };

  d3.selectAll(".link") .on("click", click_path);
  d3.selectAll(".cycleLink").on("click", click_path);

will make them clickable. Then the paths need to store the identifiers of the nodes they attach so that the Sisense widget code can attach a click event that retrieves the target and source for filtering.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.