Yesterday, the new version of D3partitionR was uploaded on CRAN, this version contains some major improvements.
1. General layout:
Before this update, the height and width of the widget were somehow messy and so was the global layout. The layout is now the following:
- Area A: Title area (exists only if the user entered a title)
- Area B: Trail area (Only if the user set the trail option to true)
- Area C: Partition chart area
- Area D: Legend area (only if the user selected a legend)
In previous version, the chart size wasn’t responsive to the chart options (Title or not, trail or not, Legend or not).
2. Bootstrap tooltip
In previous versions, the tooltip was sometime badly positioned (for exemple when scrolling the page, or placing the chart in a box). I replaced the homemade tooltip with the one from bootstrap which use tether.js library for positioning, this should made the positioning much more robust (you can see it on the Japan trade app for instance).
Before the update: Tooltip isn’t on the node
After the update: Tooltip is properly positioned
3. Trail and sequence visualisation:
Sometimes when you zoom on some part of the chart, you may forget where you’re really in the current sequence.
Using the breadcrumb trail from https://bl.ocks.org/kerryrodden/7090426 , you now can see where you are positioned in the chart and get the size of the different steps.
Exemple of the new trail
##Code used to create the visualisation above library(D3partitionR) D3partitionR(T,width=600,height=600,legend=list(type="sequential", color=list(B="#e8ae46",C="#bf3a8e")),title=list(text="My Title"),trail=TRUE)
4. Future developments
One of the major improvement that could be made, would be to make the package compatible with hclust and other hierarchical data formats from R. Hopefully, v0.4.0 will make it possible to use D3partitionR with hclust objects and nested lists (instead of using the list format which can be tricky sometimes).
The two main issues to be tackled to add these functionalities are:
- How to convert the hclust data to a nested list with the properties and values required for D3partitionR ?
- What is useful to be shown from a hclust object in a D3partitionR ? For instance, keeping all the nodes would make the chart far too complicated and deep, so should the user provide a given cut-off ? Should it be computed automatically ?
You can find the code of the package here.
[twitter-follow screen_name=’AntGuilllot’ show_screen_name=’yes’]