Graph

Graph

new Graph()

Source:

A common API used to plot everything except the datapoints and legend themselves.

  • Axes - X, Y and optional Y2 axis
  • Grid - Horizontal and vertical
  • X,Y,Y2 Axis ticks
  • Axes Labels

Lifecycle functions include:

  • BeforeInit
  • Init
  • Render
  • AfterInit

Methods

destroy() → {Graph}

Source:

Destroys the graph: Container and canvas.

Returns:
  • Graph instance
Type
Graph

generate(input) → {d3.selection}

Source:

Since we don't have the concept of z-index in visualization, the order of rendering should be following:

  • SVG container
  • Reference ranges
  • Grid
  • X-Axis
  • Y-Axes
  • Labels
  • Legend
  • Reference line when Y Axis shows/pads negative values
  • Data [In our case we have load and unload]
Parameters:
Name Type Description
input object

Input JSON

Returns:

d3 selection node of svg.

Type
d3.selection

loadContent(content) → {Graph}

Source:

Loads the content onto the graph. The content serves as a 1to1 relationship. For rendering multiple data sets respective number of content needs to be provided.

Parameters:
Name Type Description
content object

Graph content

Returns:
  • Graph instance
Type
Graph

reflow(graphData) → {Graph}

Source:

Updates the graph axisData and content.

Parameters:
Name Type Description
graphData Array

Input array that holds updated values, key and labels

Returns:
  • Graph instance
Type
Graph

resize() → {Graph}

Source:

Resizes the graph canvas. Uses the clipPath def. It scales the graph on resize, and translates the graph elements: Axes Grid Labels

Returns:
  • Graph instance
Type
Graph

unloadContent(input) → {Graph}

Source:

Unloads the content from the graph. The content serves as a 1to1 relationship. For rendering multiple data sets respective number of content needs to be provided.

Input can be either a GraphContent instance or just an object containing a key of the content to be removed

Parameters:
Name Type Description
input object

Graph content to be removed

Returns:
  • Graph instance
Type
Graph

Graph

new Graph(input)

Source:
Parameters:
Name Type Description
input GraphConfig

Input JSON instance created using GraphConfig

Methods

destroy() → {Graph}

Source:

Destroys the graph: Container and canvas.

Returns:
  • Graph instance
Type
Graph

generate(input) → {d3.selection}

Source:

Since we don't have the concept of z-index in visualization, the order of rendering should be following:

  • SVG container
  • Reference ranges
  • Grid
  • X-Axis
  • Y-Axes
  • Labels
  • Legend
  • Reference line when Y Axis shows/pads negative values
  • Data [In our case we have load and unload]
Parameters:
Name Type Description
input object

Input JSON

Returns:

d3 selection node of svg.

Type
d3.selection

loadContent(content) → {Graph}

Source:

Loads the content onto the graph. The content serves as a 1to1 relationship. For rendering multiple data sets respective number of content needs to be provided.

Parameters:
Name Type Description
content object

Graph content

Returns:
  • Graph instance
Type
Graph

reflow(graphData) → {Graph}

Source:

Updates the graph axisData and content.

Parameters:
Name Type Description
graphData Array

Input array that holds updated values, key and labels

Returns:
  • Graph instance
Type
Graph

resize() → {Graph}

Source:

Resizes the graph canvas. Uses the clipPath def. It scales the graph on resize, and translates the graph elements: Axes Grid Labels

Returns:
  • Graph instance
Type
Graph

unloadContent(input) → {Graph}

Source:

Unloads the content from the graph. The content serves as a 1to1 relationship. For rendering multiple data sets respective number of content needs to be provided.

Input can be either a GraphContent instance or just an object containing a key of the content to be removed

Parameters:
Name Type Description
input object

Graph content to be removed

Returns:
  • Graph instance
Type
Graph