It’s been about eight months since we announced d3.chart, and today we’re excited to release a new version of the framework for creating reusable visualizations. We’ve strived to incorporate as many of the lessons we learned in the eight months since the initial release.
Any developer who has been writing software for more than 6 months knows what regret feels like. Our old code often prompts questions along the lines of, “What was I thinking?” I wish it weren’t the case, but the same phenomenon applies to code you promote for general public use.
For instance, we know that “KISS” is a popular acronym for “keep it simple,
stupid”. This tenet holds particular importance to open source projects, where
collaboration is contingent on the approachability of the source. Somehow,
knowing these things did not stop us from writing a function that was
variadicNew. Sure, it allowed chart constructors to accept any
number of arguments, but this feels like a minor perk when compared to the
complexity it introduces to the library internals. We’ve removed it in version
0.2for simplicity’s sake.
Read more about chart initialization in our guidehere.
We’re also familiar with the benefits of the single-responsibility principle.
This did not stop us from designing a chart method that both created a new
chart and attached it to the parent—
Chart#mixin. In version 0.2,
charts are created with a constructor and attached in a separate operation
This grants chart creators finer control when composing charts from other
Read more about the
attach method in our guidehere.
There has been a longstanding challenge in composing multiple charts that each
require different portions of the parent’s data. We experimented with less-than
optimal workarounds to address this (for example, overriding an instance’s
transform method to serve this
but we ultimately decided we needed to change the library to help out. In
version 0.2, we are introducing
a method that allows separating the incoming data for the various attached
charts more easily.
Read more about the
demux method in our guidehere.
We’re dedicated to making d3.chart as good as it can be, and we’re full of
ideas for where it can go next. We’ll be revisiting
Chart#mixin with an eye
towards reusable visualization “components”—elements like tooltips and
keys that are intended to supplement other charts. We’ll look at how attachment
Charts might themselves be data-driven (enabling visualizations with variable
number of data series). We’ll see if d3.chart might more cleanly integrate with
D3.js’s Layouts andLines. And of
course, we’ll continue working with the library users to identify new
We don’t know where d3.chart is going, but we’re excited to figure it out with you!