Skip to content
thomassuckow edited this page Jul 9, 2013 · 7 revisions

##Global Object Functions

nv.addGraph( generator(), callback() )
nv.addGraph( { generate: generator(), callback: callback() } )

Schedules a new graph to be rendered using the given generator method. The callback argument is optional.

FIXME: When is it called back? Does it get any arguments?

nv.addGraph(function(){
  var chart = nv.models.lineChart();
  //...
  d3.select("svg").call(chart);
  return chart;
});

nv.utils.windowResize( callback() )

Executes the callback after the browser window has been resized

nv.utils.windowResize(function(){ chart.update(); }); //Redraw chart when window resized

##General Chart Functions

chart.margin( {values} )

Defines the margin (in pixels) around a chart. Pass an object containing the values

chart.margin({top:10, right:10, bottom:10, left:10})  

chart.width( value )

Defines the width of the chart (without margins) in pixels as rendered in the svg element, not the width of the svg element, itself.

chart.width(960)  

chart.height( value )

see chart.width()


chart.color( [values] )

Defines the colors used for chart elements where values is an array of rgb, rgba, hex, or string color values. The colors will repeat if there are more chart elements than colors.

##Chart-specific information

Clone this wiki locally