Fun things I’ve been learning lately about the modern ways to do things on the web:

  • The Blob API!
    (For generating downloadable export files on demand.)
  • async Promises!
    (For accepting an uploaded file and obtaining its text. Special guest star: Blob.text().)
  • CSS Grid layout!
    (Because I should probably remake the whole layout with it someday.)

As always, MDN Web Docs has been invaluable for documentation and examples.

A cool feature is cooking!

(cross-posted from vis.social/@SankeyMATIC)

Big updates: Better layout, new controls

3 small example diagrams showing some of the new output capabilities of SankeyMATIC. The first example is a funnel where the initial nodes lose value and converge on a single final node. The second is an image where one node splits into two child flows; the top child node splits into two more child flows; then the top grandchild splits into two more flows. The third is a binary tree showing 8 elements collapsing down to one and then splitting into 8 nodes again on the far end. Each type of image will be referenced below.

Adapted from a Mastodon thread.

Friends: I have been spending time in the Land of Somewhat Challenging Geometry Algorithms.

After an extended stay there, I return to you with some visible improvements to share.


Improvement #1: A better layout engine!

SankeyMATIC has new ideas about how to arrange Nodes and Flows.

It now puts more effort into producing more balanced, more symmetrical, less lopsided diagrams.

Below are a couple of examples showing the difference it can make.

(To make comparisons clear, the same data inputs were used for the Old vs. New versions.)


One specific improvement these changes make possible:

Tree diagrams which are symmetrical!

You see tree patterns in lots of places, including sports tournament brackets.

Despite their simple structure, SankeyMATIC was not handling them well before.

It’s much better now:


When your data has any other internal symmetry, the diagram ought to reflect that when it can.

Now, Flows from Nodes which don’t have their full value flowing in/out can attach to the bottom of a Node when that makes sense.

This usually makes such diagrams look better, e.g. in the case of a funnel pattern:


Improvement #2: More precise controls

The “Spacing” slider for Nodes has split into two: “Height” & “Spacing“.

Before, the slider was controlling both height & spacing, which wasn’t flexible.

Splitting them up gives you many more possibilities for how your diagrams look (as seen in the example images above).


In summary:

  1. Better-looking layouts!
  2. More precise visual controls!

Try out the changes! In particular, play with the Height & Spacing sliders to see how they interact.

P.S. The code behind these improvements is already posted to github.com/nowthis/sankeymatic. The commits from October 2 – November 3, 2022 contain the key changes.

P.P.S. Enormous thanks to everyone who has donated in the past; your interest and generosity help to motivate work on improvements such as these. 🙂

New Feature Roundup!

Been busy making lots of changes, but haven’t been making lots of announcements.

Fixing that now!

Below are some highlights from the period April through early October, 2022; some of these items may get expanded posts in the future.

(The more recent major layout changes will get their own separate post soon.)

  • Three major long-awaited changes:
    • April: When you drag a Node to a new position, the Node stays where you put it. (It no longer snaps back to its original position just because you changed the font size, diagram height, or anything else).
      • You can use the Shift key when dragging to constrain the move to be only horizontal or only vertical.
      • Double-clicking a Node moves it back to its original position.
    • July: When you place your labels before the first Nodes or after the last Nodes, the diagram’s width is automatically adjusted to give them enough room.
      • This makes it simple to try different label positions without needing to change any margins.
    • October: You can now make the diagram use the exact order of your input data, no matter what the effect is on the layout.
  • Improvements to accessibility and to the overall user experience:
    • June: Labels on your diagram will now have higher contrast ratios by default, by adding a translucent highlight rectangle around them.
      • This allows you to use darker flow colors without sacrificing readability.
      • The highlights can be turned off using a slider in the Labels section, but I think you’ll like how much easier labels are to read.
    • June: When changing any slider (and when hovering over one), you now get a tooltip telling you precisely what value the slider is currently at.
  • More minor improvements:
    • June: When you hover over a flow, the nodes at both ends of that flow now have their labels emphasized. This can be handy when diagrams have many, many flows.
    • June: Node borders work much better now. The border width can be controlled more precisely, and their widths are included when determining how much room there is for labels (and for the rest of the diagram).

Try out these changes on the Build page!

New Feature: Control your diagram’s Spacing with a slider!

In the past, you could type a number to set the spacing between each Node in a column, but:

  • Getting the spacing just right involved a lot of trial and error.
  • If you changed your diagram’s height or margins, the spacing value was not adjusted accordingly.

Now, you have a ‘Spacing’ slider which gives you an easy way to try out many different spacing approaches without needing to guess at a specific number.

And as a bonus, the look of your diagram will be preserved even when you change the height or margins.

Animation showing the SankeyMATIC interface with the new Spacing slider. Sliding the thumb to '0' removes all the space it can, making the flow diagram look more like a simple horizontal bar graph. Sliding the thumb to 'Max' makes the flows as thin as they can be (without making them disappear entirely).
A short animation showing the feature in action

One thing to keep in mind: The more spacing you add, the harder it becomes to accurately compare flow sizes, as you can see above.

Try it out! It’s actually pretty fun to experiment with.

(Honestly, it’s one of my favorite features ever.)

More fixes

  • Color themes were not being applied to Nodes when their names used non-Latin characters. This now works as expected. Thanks to @IvanaGyro for the bug report.

New Feature: Better Color Selection Tools

Now, choosing a color theme for your Nodes is much more flexible and fun.

  • There are now four updated themes to choose from (up from 3). For more about these color schemes, visit the d3 color scales page.
  • Each theme’s colors are visible at all times.
  • You can now rotate the colors within a theme so that SankeyMATIC will start assigning colors from any point in the list that you choose.Click the “<” and “>” buttons for your selected theme to adjust the starting point.
  • Every color in every theme will reveal its color code when you hover over it.This is handy if you want to adopt one specific color in your inputs.
    • Example: Screenshot showing a mouse hovering over a single color in a theme. A tooltip appears with this text: #e7298a from d3 color scheme Dark2.
  • Try it out!

Additional changes:

  • SankeyMATIC now uses version 7.3.0 of the d3.js library (a major upgrade from version 2.10.3)
  • Labels for selected radio buttons and checkboxes are now highlighted with color to make them easier to find.Labels for un-selected radio buttons and checkboxes are now dark gray instead of black.

January 2022: Straight flows; Bigger better downloads

New Feature: Straight Flows

SankeyMATIC has long had the ability to adjust the curvature of flows with a slider labeled Curviness.

However, it has not had the ability to remove all bends from the flows, since that actually requires a different drawing approach. (Straight or flat flows are really parallelograms, and no Bezier curve is going to produce that shape.)

That problem is now solved.

Setting the Curviness slider all the way to the left now produces truly straight flows.

Tiny example Sankey diagram showing flows which curve a little bit
Still a little curved…
Tiny example Sankey diagram showing flows which are completely flat
Totally flat!

New Feature: Extra Large image download format: 6x

For people who want higher-resolution output, there is now a 6x PNG image export option.

  • Tip: Depending on your diagram size and on your device, generating 4x or 6x images may make your experience filled with long pauses.To avoid this, set the export PNG image’s Size to 1x or 2x while you are setting up your diagram so that you can iterate quickly.Wait until you are truly ready to export before choosing 6x.

New SankeyMATIC Logo!

SankeyMATIC logo - a flow diagram in the shape of an S

The new ‘S’ logo will be used:

  • on Twitter (now Mastodon)
  • on GitHub
  • as the little icon for this site in your web browser
  • and so on.

Better filenames for downloaded images

Downloaded PNG image files now have a date/time stamp in the name, like: sankeymatic_20220130_155723_600x400.png.

  • This makes it easy to sort the files by when you created them, which is often handy.
  • This also avoids annoying duplicated filenames – you won’t see “sankeymatic_1200x1200-3.png”, “sankeymatic_1200x1200-4.png”, etc. any more.

Added “Made with SankeyMATIC” tag

When people post their SankeyMATIC diagrams to social media, it’s very common for others to ask: “What did you use to make that?”

I’ve added a Made with SankeyMATIC tag to diagrams by default to help answer the question before people ask it.

For anyone who does not want the “Made with SankeyMATIC” tag, there is a simple nearby checkbox, plainly visible, to remove it.

Other minor changes

  • Various improvements to the SVG code which SankeyMATIC produces – better organized, better labeled, no unnecessary precision, etc.
  • Fixed a bug where unwanted trailing 0s could appear on values when the chosen Number Format used a ‘,’ as the decimal point and ‘Always show full precision’ was unchecked.
  • Updated the JavaScript dependency Canvg to version 3.0.9 (from version 1.3).

December 2021: Sliders and Samples

New Feature: Sliders now produce ‘live’ changes

Appearance controls which use sliders (examples: Curviness, Node Opacity, Flow Opacity, Border Width) now make immediate changes to the diagram as you drag them.

This makes it much easier to observe what each slider is doing and to precisely pick the value you want.

Small screenshot showing the 'Curviness' slider from the SankeyMATIC Build page

Added multiple sample diagrams

Now there are 3 different diagrams you can use as starting points when you first begin.

Note: When you have made any changes to the Inputs field, choosing a new base diagram will alert you that you will lose your changes if you continue.

Other minor changes

  • In the Inputs section, comments are now indicated using two slashes (“//”) instead of an apostrophe.
    • The double slash is a standard comment marker for many languages and formats, so this will hopefully be more familiar to more people.
    • Typing apostrophes on iOS devices defaulted to the ‘smart’ version, making it require several steps to successfully enter a comment. This change eliminates that difficulty.

New Feature: Better user experience when a diagram does not add up

Previously:

  • SankeyMATIC treated any imbalance as an error and produced a prominent warning at the top of the page.
  • The list was not formatted in an easy-to-read fashion.
  • There was a way to turn off the check for balanced nodes, but that checkbox was buried in the Advanced settings panel and difficult to discover.

Now, SankeyMATIC will let you know that there are nodes with differences (not imbalances).

  • The notification is now below the diagram, not above (since it does not need to urgently grab your attention.)
  • The list of differences is now displayed in a more readable table.
  • The checkbox to stop listing differences is just above the list, making it much easier to find and use.
Before:
Screenshot of the old SankeyMATIC warning about node values not matching, starting with 'The Flow Cross-Checker found some imbalances'.

After:
Screenshot of the new SankeyMATIC differences list. There is now a checkbox which controls whether you want to see the  differences, and the list is organized in a table to be more easily read.
When ‘list the differences’ is unchecked:
Screenshot of the new SankeyMATIC display when the box to list differences is unchecked. No list of differences is shown.