Class Chart

The parent class for all types of Chart used to initialise all of the base settings universal to all charts. In handles data setting/updating, document resizing and includes the tooltip.

Hierarchy

Constructors

Properties

axis: Axis

The chart's axis object instance

chartConfig: ChartConfig

The chart's config object

chartData: ChartData

The chart's data array

chartOutWatcher: ChartEventListener

An event watcher for the user moving the mouse out of the chart

chartType: ChartType = 'bar'

The chart's type

container: HTMLElement

DOM reference to container element that wraps SVG

SVG d3 object for d3 operations on the chart

d3Title?: DivSelection

d3 reference to chart title element

doTransform: boolean

Whether to transform keys from an unknown data schema

height: number

The current calculated height of the chart

initialWidth: number

The width before any browser resize

innerHeight: number

The current calculated inner height of the chart

innerWidth: number

The current calculated inner width of the chart

key: Key

The chart's key object instance

loader: HTMLElement

DOM reference to loader display element

padding: Padding = ...

The padding for the chart within the container

resizeOffset: number = 0

The chart's resize offset

resizeWatcher: ChartEventListener

An event watcher for the user resizing the browser

svg: SVGSVGElement

SVG DOM object for displaying the chart

tooltip: Tooltip

Chart's tooltip object instance

transitionTime: number = 500

Default time for d3 transitions on the chart

width: number

The current calculated width of the chart

Methods

  • Sets the local config options for the chart.

    Throws

    missing configuration

    Parameters

    • chartConfig: ChartConfig

      JSON configuration object

    • shouldAddColors: boolean = false

      determine whether to add random colours to the config

    Returns void

  • Sets the local container object. #

    Throws

    invalid DOM element

    Parameters

    • container: null | HTMLElement

      Required DOM element

    Returns void

  • Sets the local chart dimensions based on the size of the container.

    Method

    setDimensions

    Throws

    missing DOM element

    Returns void

  • Updates the local config for the chart.

    Method

    updateConfig

    Parameters

    Returns void

  • Updates the local data for the chart.

    Parameters

    • chartData: ChartData

      array of JSON objects

    • bRender: boolean = true

    Returns void

Generated using TypeDoc