Skip to content

Instantly share code, notes, and snippets.

@gka
Created March 30, 2012 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gka/2255896 to your computer and use it in GitHub Desktop.
Save gka/2255896 to your computer and use it in GitHub Desktop.
API for dead simple line charts (based on raphael and d3)
var data = { 
   a: [1,2,3,2,2,3,4,5,6],
   b: [5,3,2,3,5,null,2,1,1,2]
};

linechart.create({
   container: '#chart',
   size: [500,300],
   data: data,  // lots of numbers
   labels: { a: 'Foo', b: 'Bar' },  // give the data rows some meaning
   format: function(n) { return n+'%' }  // define how numbers look on axis and tooltips
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment