d3 extension

d3 extension is a framework for the D3 JavaScript library.

Commands

dbr.d3 - Create a d3 object
dbr.d3.sankey_format - Format the Sankey tooltips
dbr.d3.zoom - Zoom the chord diagram when data has long texts

Syntax

select 'dbr.d3', 'chart_type'
select 'dbr.d3.sankey_format', 'd3_numeric_format', 'number_suffix'...
select 'dbr.d3.zoom', pixels

Usage

A Sankey diagram is a flow diagram, in which the width of the arrows is shown proportionally to the flow quantity.

Use one of the following data selections. At first, the nodes are identified by name, and in the second, by id.

select source, target, value
from mydb.Data;

select source_id, source, target_id, target, value
from mydb.Data;

A Sankey diagram

    
select 'dbr.d3', 'sankey', 'UK energy production and consumption in 2050',960, 500;
select 'dbr.d3.sankey_format', ',.0f', ' Twh';

select source, target, value
from  demo_uk_energy;
    

A chord

A chord diagram shows inter-relationships between data in a matrix.

A cord data shows connected nodes with value

select `to`, `from`, value
from mydb.Data;

Create a Chord diagram

    
select 'dbr.d3', 'chord', 'Debt diagram';

select creditor, debtor, value
from debts;