Skip to main content
100%

VIX

✓ Published0🌍 Public
GGerHobbelt
Last edited Sep 10, 2012
Created on Feb 20, 2012

This interactive calendar heatmap visualizes the VIX (volatility index) across multiple years, rendered as horizontal time strips using D3.js. Based on the original VIX calendar example, it encodes daily values using a YlGn color scale, with each day colored according to its value. The years are placed side-by-side, with intelligent year label placement that accounts for week boundaries. A mouse-driven horizontal scrollbar effect is implemented: hovering near the left or right edge (within a 150-pixel zone) smoothly scrolls the strip, with the scrolling speed proportional to the mouse's proximity to the edge. The animation is achieved with setTimeout-based timing rather than setInterval. SVG rendering with crisp edges and colorbrewer palettes completes the visualization.

AI-generated description

Calendar/VIX example v2.0 �� <a href="http://bl.ocks.org/1867866" title="view this gist via bl.ocks.org">?</a> <a href="http://bl.ocks.org/GerHobbelt" title="view a list of all my gists at bl.ocks.org">8</a>

now shown as time strip with mouse-based smooth scrolling

This example is derived from the D3.JS VIX example, and adds these features:

  • years are rendered as a 'strip', i.e. next to one another

  • 'intelligent' year text placement: the year blocks are placed as close together as possible, while leaving space for the year (text), which is placed taking the end-of-year break in the week into account

  • horizontal scrolling by mouse position: hover the mouse over the calendar strip: at left and right there's a 150px sensitive area which triggers smooth scrolling the calendar strip.

  • accelated scroll: the closer you move your mouse to the left/right edge, the faster the strip will be scrolled.

Tech notes

  • I am wondering whether the .data().each() idiom used in here to access/use the data in a node is the smart thing to do. It is NOT a sure fire thing: when you go and edit this stuff and use selectAll() and friends in there, you may be surprised.

  • This isn't the cleanest thing out there IMHO, but this is the current state of the experimental code for an art site I'm working on. If it works, that's great. Can do nice & clean later when time permits.

  • since migrating from setInterval() to setTimeout(), one might argue that the stop_calendar_timer() function isn't needed any more, since the fps would usually be faster than the user himself, or at least it would seem like that anyway. Nevertheless, I kept the method in there to at least have that part of the code adhere to strictest sensible coding SOPs.

  • if anything gives me the heebie-jeebies, it's the 'm', 'w', 'h' and them other globals in there, but I'm puritan there. :-)

Similar vizzes