Building Interactive Mobile Dashboards with D3 and other Charting Libraries

Tablets offer a great way to visually explore data using touch-based interactions. I’ve recently been looking at HTML/JavaScript charting libraries from a Mobile perspective, and I thought I’d share the sample application I used to experiment with different options.

Sample Application

It’s Olympic season, so I decided to create an interactive dashboard to explore the results of the last five Winter Olympics. I had three key requirements for my simple Olympic dashboard:

  1. Mobile first: Uncompromised performance and user experience on mobile devices.
  2. Interactive: Support for touch-based interactions and animations.
  3. Modern look.

photo

Charting Libraries

There has traditionally been a number of free (Flot, Flotr2, jqPlot, etc.) and commercial (amCharts, Highcharts, FusionCharts, etc.) options in the charting library landscape. In the last couple of years, d3.js (D3) has emerged as a de-facto standard for data visualization, and enjoys fast-growing adoption. D3 is based on Web standards (SVG, JavaScript, HTML, and CSS), and its fairly low level APIs give you complete control over the final result. D3 also has a broader scope than the charting libraries mentioned above (examples here).

Based on the requirements mentioned above, I eliminated a few options. For example, the Chart.js charts look good, but a quick look at the documentation indicates that “If you are looking to add interaction as a layer to charts, Chart.js is not the library for you…”. Different applications have different requirements, and these requirements may lead to different choices. One lesson I learned is to test on device early: some charting libraries may work great in your computer’s browser, but not so well on mobile devices, especially when it comes to touch-based interactions.

Implementation

I tried different libraries as part of my experiments, and I’ll share two implementations below. This doesn’t mean that other options are not as good: I just didn’t have time to fully implement the dashboard with every single library. If you use one of the other libraries, I’d love to hear what you think. Also feel free to fork the repo and implement the dashboard with your favorite library, or submit a pull request to improve the implementations below. It would be great to see additional implementations.

ChartJS

ChartJS (different form Chart.js mentioned above) has good looking and mobile-ready components out-of-the box, and allowed me to build a prototype quickly.

Note: ChartJS is a commercial product but has a “free for non commercial use” option. This is by no means an endorsement of the product.

Watch the ChartJS implementation video:

Click here to run the ChartJS implementation in your browser.

D3

As mentioned above, D3 has become a standard for data visualization. There are also libraries built on top of D3 (dimple, NVD3, xCharts, Rickshaw, …) for people looking for higher level APIs. I used xCharts for some of the charts in my D3 implementation.

Watch the D3 implementation video:

Click here to run the D3 implementation in your browser.

Summary

Because of its broader scope and lower level API, D3 has a steeper learning curve compared to other charting libraries. However, it gives you complete control over the final result and it’s definitely worth the time investment. It also has a fast growing community, and an impressive list of examples you can learn from. If you are looking for an out-of-the-box solution with higher level APIs, you may also consider one of the other free or commercial options mentioned above. As always, evaluate the options based on your own background and your own requirements. I’d love to hear about your own experience building interactive mobile dashboards.

Source Code

The source code for the ChartJS implementation is available in this GitHub repository.

The source code for the D3 implementation is available in this GitHub repository.

8 Responses to Building Interactive Mobile Dashboards with D3 and other Charting Libraries

  1. Amer February 19, 2014 at 10:57 am #

    Wow, this remind me with your good old days when you did this with Flex :)

  2. Colin Scroggins February 20, 2014 at 12:26 am #

    Great post! Could not be more timely. Thanks for the introduction to ChartJS.

  3. Shams February 20, 2014 at 11:18 am #

    i never test D3 but highchartJs has all that you need for both, mobile and desktop. Could you update this post why highchartJs not included in your experiment?

    thanks stephen

  4. JEL February 20, 2014 at 7:32 pm #

    can you just guide us on complete tuto

  5. Pallav March 4, 2014 at 1:43 am #

    If you’re building complete dashboards for a mobile-first world, with performance and touch-interactivity as key elements, you may also want to look at RazorFlow JavaScript SDK @ http://www.razorflow.com

    It abstracts you from having to deal with cross-browser and cross-device issues, and gives you a standardised way to build complete dashboards (which automatically adapt to different forms and devices), with built-in support for different chart types, filters etc.

  6. BlueSandy April 16, 2014 at 5:24 am #

    Hi,

    Is this code under a specific license agreement ?

    Best regards

Trackbacks/Pingbacks

  1. Building Interactive Mobile Dashboards with D3 and other Charting Libraries | SDK News - February 19, 2014

    […] Building Interactive Mobile Dashboards with D3 and other Charting Libraries […]

  2. Building Interactive Mobile Dashboards for the Salesforce Platform | Christophe Coenraets - February 24, 2014

    […] my previous post, I shared a sample application showing how to build highly interactive mobile dashboards using Web […]

Leave a Reply