Golodhros' first block!
This chart takes as a base the simple bar chart by Mike Bostock and refactors that example using the reusable API, making it responsive and configurable.
It also uses the Data Manager API from the Developing a D3.js Edge Book.
It includes tests and was conceived on a TDD basis for the talk Better D3 Charts with the Reusable API.
From the original Block:
This simple bar chart is constructed from a TSV file storing the frequency of letters in the English language. The chart employs conventional margins and a number of D3 features:
Gist to serve as template for future TDD D3 blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @summary Generates a testObjectBuilder example object | |
* @requires underscore, requirejs/commonjs | |
*/ | |
var testObjectBuilder = function(require) { | |
'use strict'; | |
var _ = require('underscore'), | |
OrderModel = require('./order_model'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Roots\Sage\LazyStyles; | |
use Roots\Sage\Assets; | |
/** | |
* Load theme scripts in the footer | |
* Ref: http://gomakethings.com/inlining-critical-css-for-better-web-performance/ | |
*/ | |
function load_theme_files() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('critical', function() { | |
var request = require('request'); | |
var path = require( 'path' ); | |
var criticalcss = require("criticalcss"); | |
var fs = require('fs'); | |
var tmpDir = require('os').tmpdir(); | |
var cssUrl = 'http://PROJECT.dev/app/themes/sage/dist/styles/main-3c29b398.css'; | |
var cssPath = path.join( tmpDir, 'style.css' ); | |
var includePath = path.join( 'dist/styles/', 'critical.css' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
OlderNewer