Class: Chart

Chart

Abstract Class representing a chart.


new Chart(options)

Chart base class constructor

Parameters:
Name Type Description
options object

Object with the following properties:

Properties
Name Type Argument Description
height number <optional>

The height of the chart, the height of the svg would be height of the chart + margin, default = 300

element object

The element to append the chart to.

margin object <optional>

Margin of chart relative to its wrapping svg.

padding object <optional>

Padding of chart data. for example, if the max value of the data is 10, setting a paddig top will make the highest point of the chart bigger than 10.

units string <optional>

Units of the values in the dataset.

prefix string <optional>

Prefix of the values in the dataset.

suffix string <optional>

Suffix of the values in the dataset.

units string <optional>

Units of the datasets.

data array

Data for the chart.

type string <optional>

The type of chart to be created.

displayRoundedData boolean <optional>

Whether to round data value to integer when displaying vlaue in legend and tooltip

isHighContrastMode boolean <optional>

Whether to use alternative color/style

Members


data :array

Gets or sets data for the chart

Type:
  • array

displayRoundedData :boolean

Gets or sets whether data displayed for this chart should be rounded, for example, if a tooltip is displayed

Type:
  • boolean

element :object

Gets or sets the element

Type:
  • object

height :number

Gets or sets the height of the chart,

Type:
  • number

margin :object

Gets or sets the margin

Type:
  • object

padding :object

Gets or sets padding for data

Type:
  • object

prefix :string

Gets or sets the prefix of the data values

Type:
  • string

suffix :string

Gets or sets the suffix of the data values

Type:
  • string

svg :object

Gets or sets the svg for the chart

Type:
  • object

type :string

Gets or sets the type of chart, could be line, bar or pie

Type:
  • string

units :string

Gets or sets the units for data values

Type:
  • string

width

Gets or sets the width of the chart content


wrapper :object

Gets or sets the wrapper of the chart

Type:
  • object

Methods


calculateYMax()

Caculate max y values

Returns:
Type
number

calculateYMin()

Caculate min y values

Returns:
Type
number

computeDataProperty()

Compute and cache data properties

Returns:

computer data related properties

Type
undefined

computeRenderProperty()

Compute and cache graphic properties

Returns:

computer render properties

Type
undefined

destroy()

Destroy the chart

Returns:
Type
undefined

getXScale()

get x scale

Returns:
Type
function

getYScale()

get x scale

Returns:
Type
function

hover(j)

Highlight datapoint

Parameters:
Name Type Description
j number

index of the dataset that should be highlighted

Returns:
Type
undefined

init()

init the chart

Returns:
Type
undefined

render()

Render the chart based computed render properties

Returns:
Type
undefined

switchColorMode()

Switch color mode

Returns:
Type
undefined

transformForD3()

Sometimes data needs to be transformed for certain layout(e.g: stack layout, pie layout)

Returns:

[description]

Type
array