Interactive Dexcom data with D3

Skip to first unread message

Jana Beck

Aug 19, 2013, 10:09:52 PM8/19/13
Hi all,

I've been learning my way around D3 (the hot new JavaScript data visualization library, for those not in the know) in the past few months, and I've put together a couple of visualizations of weekly-batched Dexcom data that I thought I'd share here.

The first is a horizontal histogram showing the distribution of blood glucose values for a given week, where the BG values are binned in 20-unit increments. You can use the 'Previous Week' and 'Next Week' buttons to flip through the weeks of data (the file it's loading currently is all the data from my G4 Dexcom receiver).

The second and third visualizations are heat maps of the same data: by hour of day and by day of week. I'm still playing with the animated transitions on these, and I'm not happy with D3's native method of interpolating frequency data as color, so I'm hoping to improve that as well.

Comments/reactions welcome!



P.S. I'm also going to be writing up something about the details of the D3 for these on my blog soon, if anyone's curious about the nitty-gritty details.

P.P.S. I tried to put the first of these up as a gist on once, but there was some difficulty (of precisely what nature, I can't remember...). So if you want to see the code, you'll have to look at the d3 branch in my iPancreas repo on GitHub.

Benjamin West

Aug 19, 2013, 10:34:50 PM8/19/13
to Jana Beck, MeDevice List
Howdy Jana,

This looks awesome.

For the color issue, try something like this:

z = d3.scale.linear() .domain([0, 160]) .range(["white", "purple"]) .interpolate(d3.interpolateLab);
The interpolateLab will produce nicer colors.

You received this message because you are subscribed to the Google Groups "medevice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

sara krugman

Aug 20, 2013, 12:01:27 PM8/20/13
to Benjamin West, Jana Beck, MeDevice List
Thats awesome :)

Sara Krugman

Health Care Design Studio

skype:  skrugman

Simon Carter

Aug 20, 2013, 10:02:55 PM8/20/13
HI Jana,

Looks great - especially like the horizontal histogram and the weekly heatmap. Is Sunday your chocolate day?

We just added heatmaps and the first 4 of 6 cgms-type charts to, so people stuck on a Mac without DEXCOM software can get great data out of these.

Reply all
Reply to author
0 new messages