Code Monkey home page Code Monkey logo

d5-boots's Introduction

d5 (ddddd)

don't duplicate data driven documents

about

Some sugar for creating a d3 timeseries chart.

Heavily inspired by M. Bostock's Towards Reusable Charts.

usage

  • include d5.js or d5.min.js (from the dist folder) on your page
<script src="/path/to/d5.js"></script>
  • place a chart element on the same page
  <div id="#chart"></div>
  • choose the type of chart you want (hint: there's only one right now)
  var opts = {}; // configure some stuff
  var charter = d5.timeSeries(opts);
  • d5 it up
  var selector = "#chart";
  var data = d5.utils.timeSeriesData(); // grab some random data

  // IMPORTANT!
  // * you have set set accessor functions for your data on `charter`
  charter.x(function(d) { return d[0]; });
  charter.y(function(d) { return d[1]; });

  // Now we're ready to go!

  // try this
  var charty = d3(selector).datum(data).call(charter);
  // or this
  var charty = d5(selector).datum(data).update(charter);
  // or this
  var charty = d5(selector, data).update(charter);
  // or even this
  var charty = d5(selector, data, charter);

what's included

  • area
  • bar (grouped)
  • bar (stacked)
  • line
  • scatter

Config

  • height
  • width
  • margin.top
  • margin.right
  • margin.bottom
  • margin.left
  • interpolate
  • xlab
  • ylab
  • colors.color
  • legend.height
  • legend.width

TODO

  • Determine levels of configurability
  • Refactor refactor refactor
  • Dynamically requiring all charts in the base-charts folder for its index.js exports object. See me about troubles I've had doing this with Browserify.

d5-boots's People

Contributors

brettimus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.