Reference Source Test
import Graph from '@ivantha/graphjs/src/graph.js'
public class | source

Graph

Graph is the base class of all operations withing the GraphJS. It acts as a factory-pattern for creating any types of charts.

Constructor Summary

Public Constructor
public

constructor(grammar: string)

Creates an instance of the class Graph

Member Summary

Private Members
private

_chart: *

Holds the instance of the charts types that was created within the object with the initial grammar.

Method Summary

Public Methods
public

do(grammar: *): boolean

Parse the grammar given by the user.

public

Return the JSON output string created by parsing the input grammar.

Public Constructors

public constructor(grammar: string) source

Creates an instance of the class Graph

Params:

NameTypeAttributeDescription
grammar string

Initial grammar provided to initiate the class. This should be in the form of : generate <GRAPH_TYPE> for <DATASOURCE>

Private Members

private _chart: * source

Holds the instance of the charts types that was created within the object with the initial grammar.

Public Methods

public do(grammar: *): boolean source

Parse the grammar given by the user.

Params:

NameTypeAttributeDescription
grammar *

Return:

boolean

public generateJson(): string source

Return the JSON output string created by parsing the input grammar.

Return:

string