Skip to main content
100%

Simple Line Chart with Color Gradient

✓ Published0🌍 Public
KKirkHunter
Last edited Apr 14, 2016
Created on Apr 14, 2016

This interactive line chart visualizes daily temperature readings from a Noe Valley sensor, using a color gradient that shifts from steelblue to gray to red to encode temperature values. The chart groups data by day, with buttons allowing users to toggle between different days. Built with D3.js and moment.js, the SVG visualization relies on `d3.time.scale` for the time axis and a linearGradient element for the temperature color encoding. The data originates from the Data Canvas project and is displayed for a slice of the full time series.

AI-generated description

These are the materials for my workshop at Strata San Jose 2015 as well as resources and next steps. Videos of the workshop can be found here.

We will be using the following two tools to works through these exercises:

I would love your feedback on the materials either on the Q&A forum (Google Group) or in the Github issues.

And please do not hesitate to reach out to me directly via email at jondinu@gmail.com or over twitter @clearspandex

Throughout this workshop, you will learn how to make this animated and interactive line plot of temperature over time in Noe Valley.

Exercises

  • Part 1: Multiple line chart of Shanghai vs. Bangalore pollution levels created with dimple
  • Part 2: Line chart of Shanghai pollution levels over time created with D3.js
  • Part 3 (you are here 👇): Interactive animated line chart with color gradient of Noe Valley (SF neighborhood) daily temperature series over time.

The Data

The data is from the Data Canvas project, which is sponsored by Gray Area, swissnex San Francisco, and Lift. It contains data from 14 sensors in 7 cities which collect and stream information about their environment (temperature, dust, pollution, humidity, light, etc.).

You an access a bulk download of all the data (100+ MB) here. You can also download samples or access the stream through the API (details on the data page).

There are 4 different granularities of measurement. Files ending in:

  • *-5md.csv: measurements every 5 minutes for a day
  • *-1hd.csv: measurements every 1 hour for a day
  • *-6hw.csv: measurements every 6 hours for a week
  • noevalley.csv (or grapealope.csv): entire history of the sensor near Noe Valley at 10 second resolution

The files are comma separated with headers and 8 fields:

<table><thead> <tr> <th align="center">timestamp</th> <th align="center">city</th> <th align="center">temperature</th> <th align="center">light</th> <th align="center">airquality_raw</th> <th align="center">sound</th> <th align="center">humidity</th> <th align="center">dust</th> </tr> </thead><tbody> <tr> <td align="center">2015-02-16T17:00:00.000Z</td> <td align="center">San Francisco</td> <td align="center">20.8856185354523</td> <td align="center">2231.45801048026</td> <td align="center">28.8458008730416</td> <td align="center">1674.71050009727</td> <td align="center">48.4880466992298</td> <td align="center">882.367404134883</td> </tr> <tr> <td align="center">2015-02-16T18:00:00.000Z</td> <td align="center">San Francisco</td> <td align="center">21.8623045793052</td> <td align="center">2542.46720508251</td> <td align="center">26.5113633058142</td> <td align="center">1652.25960948903</td> <td align="center">43.9341875396295</td> <td align="center">912.0280753969</td> </tr> <tr> <td align="center">2015-02-16T19:00:00.000Z</td> <td align="center">San Francisco</td> <td align="center">23.5113166041101</td> <td align="center">3215.03460441893</td> <td align="center">24.8987852323788</td> <td align="center">1690.5842506536</td> <td align="center">40.5058249680354</td> <td align="center">939.447105875158</td> </tr> <tr> <td align="center">2015-02-16T20:00:00.000Z</td> <td align="center">San Francisco</td> <td align="center">25.6472096479114</td> <td align="center">4558.69142401972</td> <td align="center">26.0867059045864</td> <td align="center">1704.29832357106</td> <td align="center">38.4312464272035</td> <td align="center">999.743066983922</td> </tr> </tbody></table>

Archival event link: Strata + Hadoop World San Jose 2015

<style> @import url(http://fonts.googleapis.com/css?family=Crimson+Text:700italic,400,700,400italic); div.gist-readme { font: "Helvetica Neue",Helvetica,Arial,sans-serif; color: #666; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; } .gist-readme pre { width: 200%; margin-left: -50%; overflow: hidden; } .gist-readme p.small { color: #bbb; font-size: 14px; line-height: 1.5; display: block; } .gist-readme blockquote { padding-left: 15px; border-left: 4px solid #5694f1; color: #aaa; } .gist-readme span.code { font-family: Menlo, Monaco, Courier; background-color: #EEE; font-size: 14px; } .gist-readme pre { font-family: Menlo, Monaco, Courier; white-space: pre-wrap; padding: 20px; font-size: 14px; } .gist-readme code { padding: .25em .5em; font-size: 85%; color: #bf616a; background-color: #f9f9f9; border-radius: 3px; border: 1px solid #eee; } .gist-readme table { width: 100%; margin: 40px 0; border-collapse: collapse; font-size: 13px; line-height: 1.5em; } .gist-readme th, .gist-readme td { text-align: left; padding-right: 20px; vertical-align: top; } .gist-readme table td, .gist-readme td { border-spacing: none; border-style: solid; padding: 10px 15px; border-width: 1px 0 0 0; } .gist-readme tr > td { border-top: 1px solid #eaeaea; } .gist-readme tr:nth-child(odd) > td { background: #fcfcfc; } .gist-readme thead th, .gist-readme th { text-align: left; padding: 10px 15px; height: 20px; font-size: 13px; font-weight: bold; color: #444; border-bottom: 1px solid #dadadc; cursor: default; white-space: nowrap; } </style>

forked from <a href='http://bl.ocks.org/Jay-Oh-eN/'>Jay-Oh-eN</a>'s block: <a href='http://bl.ocks.org/Jay-Oh-eN/107ffc782c1c96f88198'>Strata Interactive Data Visualization: Exercise 3</a>

forked from <a href='http://bl.ocks.org/Jay-Oh-eN/'>Jay-Oh-eN</a>'s block: <a href='http://bl.ocks.org/Jay-Oh-eN/7c394d3e8737736e3090ca414dd72b85'>Simple Line Chart with Color Gradient</a>

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/8463b9e916b6efa5f24762b53fd46877'>Simple Line Chart with Color Gradient</a>

Similar vizzes