-
Book Overview & Buying
-
Table Of Contents
Ember.js Cookbook
By :
D3.js is a JavaScript library used to manipulate document data. It can be used to create shapes, animations, and powerful visualizations. It uses web standards such as HTML, SVG, and CSS to accomplish its goals.
Ember.js can use D3 by importing it as a library using Bower or using it as an add-on. We'll be trying it out using Bower. However, you can install the popular ember-cli-d3 package (ember install ember-cli-d3) instead and get some extra functionality.
In a new application, run these commands in the application folder:
$ bower install d3 –save $ ember g component d3-code
The bower command will install D3 and save it to the bower.json file. The component will end up holding all our D3 code.
Edit the ember-cli-build.js file and add the d3 file:
// ember-cli-build.js
/*jshint node:true*/
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults...
Change the font size
Change margin width
Change background colour