(quality of documentation, code complexity)How much can I customize my charts?Is the library actively supported?What types of data does this library take?What modes of interactivity are offered?Does the library offer responsive charts?Learning curveDygraphs, Chart.
js, and Google Charts have relatively small learning curves.
They are great if you need to whip up charts in a couple of hours.
D3 has the highest learning curve, and the reason for this is the fine-grain, low-level control it offers.
It’s more of a well-written library of advanced helper functions.
D3 can theoretically be used in conjunction with other charting libraries.
To explore a bit further, I created the same chart across all 4 libraries using Boston weather data from meteoblue.
The code is up on GitHub.
Top row: D3, Dygraphs, Bottom row: Chart.
js, Google Charts….
and recorded the lines of code needed to make each chart:The lines of code support the original comparison of learning curves.
D3 needs significantly more lines to get a basic chart up and running but provides more opportunity for customization.
CustomizationD3 shines in the customization arena.
D3’s granularity and modularity is exactly why designers and developers favor it as the medium for stunning and unique visualizations.
js and Google Charts offer numerous options that can be passed into a generator function, such as legend font size and thickness of a line.
Active developmentI define library development as the frequency of releases and the responsiveness of library maintainers to opened issues and feedback for improvement.
A supportive and large community of users is also a plus.
Looking at the respective GitHub repositories, I discovered releases and resolved issues for Dygraphs and Google Charts to be more sporadic than D3 and Chart.
D3 will not reach a halt in development any time soon.
Its creator and contributors recently released a major version (v5.
0) in 2018.
They still actively contribute to the visualization community.
js’s latest release also occurred pretty recently in 2018.
The release addressed issues and enhancements.
They are documented thoroughly in the release notes.
Types of dataThis speaks for itself.
Fun fact: I used D3’s fetch library to fetch data.
I used other libraries to chart it.
D3 has fetch functions for almost all common data formats used in data visualization.
js, and Google Charts all have some out-of-box interactivity features, like tool tips, zoom, and events.
It’s difficult to introduce highly custom interactions because each library is so encapsulated.
With D3, you accept that complicated and unique interactions are possible.
The tradeoff is simple interactions, like a tool tip, must also be constructed from the ground up.
js and D3 offer responsive charts out of the box (for D3, specify a viewBox instead of width and height for the svg container).
Dygraphs and Google Charts need some additional work to create responsive charts, like adding position: relative to the chart container or redrawing the chart on $(window).
Dygraphs responsive chart (inspect the chart containers to see the CSS classes)Responsive Google Charts Stack Overflow threadBest used for?Last but not least, I’ve listed the use case that I think each library is best suited for:All screenshots taken from each library’s respective examples sectionD3 is worth investing time in if you a) need a highly custom visualization and/or b) want helper functions to use in conjunction with other libraries.
I enjoyed Dygraphs for time series because the user can pan over the series and see the date and corresponding point by default.
You can also highlight specific periods of time and select ranges of time.
js allows you to create simple, aesthetically pleasing charts that pop into the page seamlessly on load.
Finally, Google Charts offered the most variety of out-of-the-box charts, compared to the other libraries.
In addition to standard charts, Google Charts also supports geographic maps, tree maps, sankey diagrams, etc.
The most important step after you’ve selected a library and generated some visualizations is to communicate, and then iterate.
Show your charts to others and ask them what they can and cannot interpret.
Listen to their feedback and keep tweaking your charts.
They’re teaching tools, and teaching tools should constantly evolve with the content and the viewers.
Thank you for reading!- — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —Code for the charts I created are up on GitHub.
Here are the presentation slides that led to this article.
If you want to read about Bokeh and D3, check out Charting the waters: between Bokeh and D3.
If you have any suggestions or feedback, drop a comment.