Parallel Sets Data Visualization of Game of Thrones Battles Years 298-300
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


An interactive parallel sets visualisation using D3.js.

Justin Gosses, 2016

Parallel Set Visualizations are a great way to show relationships and distribution in a dataset with many shared categorical data dimensions, but they can quickly become a visual mess if they have too many dimensions or too many unique categories for each dimension.

This is an attempt to minimize that problem by adding some UI features that let the user :

1. Choose which dimensions to show

2. Limit the data shown to data that matches certain values for certain dimensions

These changes move this parallel set visualization into more a data exploration tool.

This project is live as a webpage.

This project builds upon d3.parsets by Jason Davies, which was based on the GUI Parallel Sets by Robert Kosara and Caroline Ziemkiewicz.

More Information:

More information can be found in a blog post and on github.


  • This application uses a tooltip function that conflicts with the bootstrap toolstrap namespace. If you're going to use bootstrap, one way around this is to only use a subset of the bootstrap CSS which excludes tooltip information.
  • Some functions were created to handle spaces and special characters in input data, but there is still possibilities of problems there.

alt tag

This section applies to the d3.parsets.userFilt.js file

# userFilt.dimension_options

Is an array that contains the various categories or dimensions the user can pick from to be visualized. These will be the column headers in the input CSV.

# userFilt.selected_options

This is an array of the dimensions options chosen to the visualized. It is a subset of the dimension options array. This array is populated initially in the code and then modified by the user via a drop-down menu.

# userFilt.limitations

This is an object consisting of multiple key value pairs where the key is a dimension and the value is an array of values for that dimension. In the situation where the user wants to visualize only some of the values in a given dimension, they are populated and depopulated in here. If they are present, that means the resulting data being given to the parallel sets visualization is limited to the data that matches those vaues for that dimension. For example, it can be limited to only battles that involve the House of Stark as a defender.

# userFilt.uniqueValuesForEachDimensionArrayOfObj

This is an array of all unique values for each dimension, used to populate secondary drop-down menu

# userFilt.state

Object that keeps track of how many times the visualization has been rebuilt.


This section applies to the d3.parsets.js file

Documentation below directly copied from


# d3.parsets()

Creates a new parallel sets chart with default settings: dimensions are automatically detected and the size is 960×600. The chart is a function that can be called on any D3 selection that has data bound to it. This function can be configured as described below.

# parsets.dimensions(dimensions)

If dimensions is specified, sets the categorical dimensions to be visualised. If a function is specified, it is invoked for every element in the target selection and an array of dimension names is expected in return. If an array is specified, it should be an array of dimension names (object keys).

If dimensions is not specified, returns the current dimensions.

# parsets.value(value)

Specifies the value accessor. If value is not specified, returns the current value accessor. The default accessor simply returns 1 for each input data element i.e. the absolute frequency count. This value is used to set the width of the horizontal bars and connecting ribbons in proportion to the value.

If the input data is a pivot table, you’ll want to set this to return the aggregate sum for each input data element. You could also use an arbitrary numerical measure instead of frequency if appropriate.

# parsets.width(width)

Specifies the chart width in pixels. If width is not specified, returns the current width, which defaults to 960.

# parsets.height(height)

Specifies the chart height in pixels. If height is not specified, returns the current height, which defaults to 600.

If a negative height is specified, this causes the dimensions to be reversed vertically, and you need to set the appropriate translate transform in the chart’s parent <g> element.

# parsets.spacing(spacing)

Specifies the total amount of spacing in pixels to be divided between the horizontal category bars. If spacing is not specified, returns the current spacing, which defaults to 20.

# parsets.tension(tension)

Specifies the tension for the ribbon curves. This should be a value between 0 and 1 inclusive. If tension is not specified, returns the current tension, which defaults to 1 (straight lines).

# parsets.duration(duration)

Specifies the duration for the animated transitions in milliseconds. If duration is not specified, returns the current duration, which defaults to 500.

# parsets.dimensionFormat(dimensionFormat)

Specifies a formatting function for the dimension name. If dimensionFormat is not specified, returns the current formatting function, which defaults to String.

# parsets.tooltip(tooltip)

Specifies a formatting function for the ribbon tooltip. If tooltip is not specified, returns the current formatting function, which defaults to:

function(d) {
  var count = d.count,
      path = [];
  while (d.parent) {
    if ( path.unshift(;
    d = d.parent;
  return path.join(" → ") + "<br>" + comma(count) + " (" + percent(count / d.count) + ")";

# parsets.categoryTooltip(categoryTooltip)

Specifies a formatting function for the category tooltip. If categoryTooltip is not specified, returns the current formatting function, which defaults to:

function(d) {
  return + "<br>" + comma(d.count) + " (" + percent(d.count / d.dimension.count) + ")";

# parsets.on(type, listener)

Registers the specified listener to receive events of the specified type from the chart. Currently, this includes "sortDimensions" and "sortCategories", which are fired when dimensions or categories are reordered.