This is a six part series, taking you through stages of designing and creating reusable visualizations with d3.js
All visualizations have the same functionality, showcase the individual points with a bar chart and sum up the selected bars.
function nextCssColor() { | |
function random(min, max) { | |
min = +min || 0; | |
max = +max || 0; | |
return Math.round(Math.random() * (max - min) + min); | |
} | |
var colors = [ | |
"aliceblue", | |
"antiquewhite", |
function parseUrl(url) { | |
url = String(url); | |
// expects api calls to be "/some/api/v(#)/some/path" with optional query params | |
// examples: http://regex101.com/r/vO8mU5/1 | |
var regex = /.*\/v(\d+)((?:\/\w+)+)\??(.+)?$/i; | |
var match = url.match(regex); | |
console.assert("Invalid URL '" + url + "'", match); | |
var result = { |
if (!Ember.productionMode) { | |
// relies on ember build tools which turn `Ember.assert` into a NOOP | |
Object.defineProperty(Ember, 'productionMode', { | |
value: Ember.assert && Ember.assert.length == 0 | |
}); | |
} | |
// more correct name name | |
// if (!Ember.assertionsEnabled) { | |
// // relies on ember build tools which turn `Ember.assert` into a NOOP |
_.mixin((function() { | |
function createPadding(value, pad, character) { | |
character = _.isValue(character) ? String(character) : " "; | |
var strPadded = ""; | |
var length = pad - value.length; | |
while (strPadded.length < length && character.length) { | |
strPadded += character; | |
} |
#!/bin/bash | |
clear | |
BORDER=$(printf '=%.0s' {1..80})\\n | |
HEADER="%-10s %8s %-10s %24s %11s\n" | |
FORMAT="%-10s %8d %-10s %11.2f\n" | |
WIDTH=150 | |
# not defined, what should this be? | |
# DIVIDER="DIVIDER" |
[ | |
// sidebar heading (bold/white) | |
{ | |
"class": "sidebar_heading", | |
"color": [255, 255, 255], | |
"font.bold": true, | |
"shadow_color": [0, 0, 0], | |
"shadow_offset": [0, -1], | |
}, |
[ | |
// highlight modified files (blue for dirty files, like default theme) | |
{ | |
"class": "tab_label", | |
"settings": ["highlight_modified_tabs"], | |
"parents": [{ | |
"class": "tab_control", | |
"attributes": ["dirty"] | |
}], | |
"fg": [20, 100, 220] |
[ | |
// highlight modified files (orange for dirty files, like default theme) | |
{ | |
"class": "tab_label", | |
"settings": ["highlight_modified_tabs"], | |
"parents": [{ | |
"class": "tab_control", | |
"attributes": ["dirty"] | |
}], | |
// "fg": [120, 170, 250], // blue |
This is a six part series, taking you through stages of designing and creating reusable visualizations with d3.js
All visualizations have the same functionality, showcase the individual points with a bar chart and sum up the selected bars.
using System; | |
namespace ConsoleApplication | |
{ | |
enum Suit | |
{ | |
DIAMOND, | |
CLUB, | |
HEART, | |
SPADE |