Base models

_Model

class nvd3._Model(name)

This class represent a model in NVS3. A model in NVD3 is an object with some settable options. These options are callables, to be more correct, they are setters. In python they are setters too: if you normally write chart.showLabels(true) in JavaScript, this become chart.showLabels(True) in Python.

name

The name of the object. It is in the form myobj for the main objects and in the form myobj.attr for the attributes.

_option_names

Tuple of options that the model supports.

_raw_options

Tuple of raw options that should not be trasformed in some kind of javascript object.

js_options()

Returns the JavaScript representation of this model. This representation does not instantiate the object but is a collection of function calls to set the properties of the object.

NVD3 base models

class nvd3.Line(name)

Represents a nv.models.line() in NVD3. Available properties:

width
Is raw:no.
Type:int.
height
Is raw:no.
Type:int.
defined

Allows a line to be not continuous when it is not defined.

Is raw:yes.
interpolate

Set the interpolation mode. The possible values are listed in the d3’s line.interpolate() documentation. Default: 'linear'.

Is raw:no.

Note

As now interpolate accepts only str.

clipEdge

If True, masks lines within x and y scale.

Is raw:no.
margin

Valid keys are: top, right, bottom and left, values must be ints.

Is raw:no.
Type:dict.
duration
Is raw:no.
isArea

Decides if a line is an area or just a line.

Is raw:yes.
x

Accessor to get the x value from a data point.

Is raw:yes.
y

Accessor to get the y value from a data point.

Is raw:yes.
color

A function that returns a color.

Is raw:yes.
class nvd3.Axis(name)

Represents a nv.models.axis() in NVD3. Available properties:

axisLabelDistance
Is raw:no.
Type:int.
staggerLabels
Is raw:no.
Type:bool.
rotateLabels
Is raw:no.
Type:int.
rotateYLabel
Is raw:no.
Type:bool.
showMaxMin
Is raw:no.
Type:bool.
axisLabel
Is raw:no.
Type:str.
height

Only used for tickLabel currently.

Is raw:no.
Type:int.
ticks

Control how ticks are generated for the axis.

Is raw:no.
Type:int.
width

Only used for tickLabel currently.

Is raw:no.
Type:int.
fontSize
Is raw:no.
Type:str.
margin

See nvd3.Line.margin for a valid format.

Is raw:no.
duration
scale
dispatch
isOrdinal
orient
tickValues
tickSubdivide
tickSize
tickPadding
tickFormat
domain
range
rangeBand
rangeBands
class nvd3.Legend(name)

Represents a nv.models.legend() in NVD3. Available properties:

  • width
  • height
  • key
  • keyFormatter
  • align
  • maxKeyLength
  • rightAlign
  • padding
  • radioButtonMode
  • expanded
  • vers
  • margin
  • color
  • updateState
class nvd3.Tooltip(name)

Represents a nv.models.tooltip() in NVD3. Available properties:

  • duration
  • gravity
  • distance
  • snapDistance
  • classes
  • enabled
  • hideDelay
  • contentGenerator
  • valueFormatter
  • headerFormatter
  • keyFormatter
  • headerEnabled
  • position
class nvd3.Focus(name)

Represents a nv.models.focus() in NVD3. Available properties:

  • width
  • height
  • showXAxis
  • showYAxis
  • brushExtent
  • margin
  • duration
  • color
  • interpolate
  • xTickFormat
  • yTickFormat
  • x
  • y
  • rightAlignYAxis
class nvd3.Pie(name)

Represents a nv.models.pie() in NVD3. Available properties:

  • arcsRadius
  • width
  • height
  • showLabels
  • title
  • titleOffset
  • labelThreshold
  • valueFormat
  • x
  • id
  • endAngle
  • startAngle
  • padAngle
  • cornerRadius
  • donutRatio
  • labelsOutside
  • labelSunbeamLayout
  • donut
  • growOnHover
  • margin
  • y
  • color
  • labelType