Skip to content

Instantly share code, notes, and snippets.

View adamyonk's full-sized avatar
👨‍💻
✌️

Adam Jahnke adamyonk

👨‍💻
✌️
View GitHub Profile

Designed by Stephen Few, a bullet chart “provides a rich display of data in a small space.” A variation on a bar chart, bullet charts compare a given quantitative measure (such as profit or revenue) against qualitative ranges (e.g., poor, satisfactory, good) and related markers (e.g., the same measure a year ago). Layout inspired by Stephen Few. Implementation based on work by Clint Ivy, Jamie Love of N-Squared Software and Jason Davies. The "update" button randomizes the values slightly to demonstrate transitions.

decodeHtmlEntity = (str) ->
str.replace /&#(\d+);/g, (match, dec) ->
String.fromCharCode(dec)
encodeHtmlEntity = (str) ->
buf = []
for (var i=str.length-1;i>=0;i--) {
buf.unshift(['&#', str[i].charCodeAt(), ';'].join(''))
buf.join('')