How Do I Build a Sankey Chart?

How Do I Build a Sankey Chart?

How to Build a Sankey Chart

If you want to analyze navigation patterns in your course, then you can show branching — and even abandonment — with a Sankey chart.

How to create — In an Advanced Graph Query widget, insert code like this…

{ "title": "Course Navigation", "subtitle": "“Neural Networks and Deep Learning” Interactions", "filter": { "object.id": { "$in": [ "https://www.coursera.org/specializations/deep-learning/1/interactions/1", "https://www.coursera.org/specializations/deep-learning/1/interactions/2"]}}, "process": [{ "$paths": { "stepValuePath": "object.definition.description.en-US", "sessionPath": "context.registration"}}, { "$pathsToNodes": { "order": false}}, { "$sankeyChart": {}}]}


The filter stage uses a logical IN to limit the nodes to the selected objects, which the widget uses as the “value path”. As is typical with Sankey charts in the LRS, the “session path” follows the context registration.


Here’s an example of a Sankey chart widget for navigation between interactions in a lesson.

How to interpret — In the chart above, three times students responded to the “Neural networks" interaction first, then the “Backpropagation” interaction. Six times students responded in the opposite order. 
You can customize this chart by adding MongoDB stages that $match length of branches and $sort last branches. You can also change the style by adding amCharts fields.


    • Related Articles

    • Why Doesn’t My Duration Chart Work?

      Use meta.duration, Not result.duration If you’re trying to build a chart with duration as the metric and it’s not working, then the reason is probably that you’re trying to get values from result.duration. Use meta.duration instead. Statements encode ...
    • What Types of Charts Can I Make in the LRS?

      In general, you can make charts in a custom dashboard using two methods: using our Chart Builder, or by programming our Veracity Query Language (VQL). Chart Builder Charts The Chart Builder and similar form-based wizards in the Veracity Learning LRS ...
    • How Do I Show Percent of Students?

      In a custom dashboard, you can easily build a bar chart that shows the number of unique students per course. Chart Builder with simulated data offered in the free Veracity Learning LRS. Problem But what if you want to show the number of unique ...
    • What are xAPI Extensions and How Do I Use Them in My xAPI Statements?

      Best Practices for xAPI Extensions Activity, Context, and Result Extensions in xAPI Statements Do you need to know when and how to best use Activity, Context or Result Extensions in your xAPI Statements? This is a common challenge and a frequently ...
    • How Do I Edit Canonical Activities?

      What are canonical activities? As xAPI statements flow into the Veracity LRS, it builds a “canon” of names for activities. For example, the LRS can extract the names and hierarchy of courses and their nested lessons and interactions from the IDs, ...