Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GraphEdgeSet

Hierarchy

  • DataSet<Edge>
    • GraphEdgeSet

Index

Constructors

constructor

  • new GraphEdgeSet(options: DataSetOptions): GraphEdgeSet
  • new GraphEdgeSet(data?: Edge[], options?: DataSetOptions): GraphEdgeSet
  • Creates an instance of DataSet.

    Parameters

    • options: DataSetOptions

    Returns GraphEdgeSet

  • Creates an instance of DataSet.

    Parameters

    • Optional data: Edge[]
    • Optional options: DataSetOptions

    Returns GraphEdgeSet

Properties

length

length: number

The number of items in the DataSet.

Methods

add

  • add(data: Edge | Edge[], senderId?: IdType): IdType[]
  • Add one or multiple items to the DataSet. Adding an item will fail when there already is an item with the same id.

    Parameters

    • data: Edge | Edge[]

      data can be a single item or an array with items.

    • Optional senderId: IdType

    Returns IdType[]

    The function returns an array with the ids of the added items.

clear

  • clear(senderId?: IdType): IdType[]
  • Clear all data from the DataSet.

    Parameters

    • Optional senderId: IdType

    Returns IdType[]

    The function returns an array with the ids of the removed items.

distinct

  • distinct(field: string): any[]
  • Find all distinct values of a specified field. If data items do not contain the specified field are ignored.

    Parameters

    • field: string

      The search term.

    Returns any[]

    Returns an unordered array containing all distinct values.

flush

  • flush(): void
  • Flush queued changes. Only available when the DataSet is configured with the option queue.

    Returns void

forEach

  • forEach(callback: function, options?: DataSelectionOptions<Edge>): void
  • Execute a callback function for every item in the dataset.

    Parameters

    • callback: function

      The item callback.

        • (item: Edge, id: IdType): void
        • Parameters

          • item: Edge
          • id: IdType

          Returns void

    • Optional options: DataSelectionOptions<Edge>

    Returns void

get

  • get(options?: DataSelectionOptions<Edge>): Edge[]
  • get(id: IdType, options?: DataSelectionOptions<Edge>): Edge
  • get(ids: IdType[], options?: DataSelectionOptions<Edge>): Edge[]
  • Get all items from the DataSet.

    Parameters

    • Optional options: DataSelectionOptions<Edge>

    Returns Edge[]

    When no item is found, null is returned when a single item was requested, and and empty Array is returned in case of multiple id's.

  • Get a single item from the DataSet.

    Parameters

    • id: IdType

      The item id.

    • Optional options: DataSelectionOptions<Edge>

    Returns Edge

    When no item is found, null is returned when a single item was requested, and and empty Array is returned in case of multiple id's.

  • Get multiple items from the DataSet.

    Parameters

    • ids: IdType[]

      Array of item ids.

    • Optional options: DataSelectionOptions<Edge>

    Returns Edge[]

    When no item is found, null is returned when a single item was requested, and and empty Array is returned in case of multiple id's.

getDataSet

  • getDataSet(): DataSet<Edge>
  • Get the DataSet itself. In case of a DataView, this function does not return the DataSet to which the DataView is connected.

    Returns DataSet<Edge>

    The DataSet itself.

getIds

  • getIds(options?: DataSelectionOptions<Edge>): IdType[]
  • Get ids of all items or of a filtered set of items.

    Parameters

    • Optional options: DataSelectionOptions<Edge>

    Returns IdType[]

    ids of all items or of a filtered set of items.

map

  • map(callback: function, options?: DataSelectionOptions<Edge>): any[]
  • Map every item in the DataSet.

    Parameters

    • callback: function

      The mapping callback.

        • (item: Edge, id: IdType): any
        • Parameters

          • item: Edge
          • id: IdType

          Returns any

    • Optional options: DataSelectionOptions<Edge>

    Returns any[]

    The mapped items.

max

  • max(field: string): Edge
  • Find the item with maximum value of specified field.

    Parameters

    • field: string

    Returns Edge

    Returns null if no item is found.

min

  • min(field: string): Edge
  • Find the item with minimum value of specified field.

    Parameters

    • field: string

    Returns Edge

    Returns null if no item is found.

off

  • off(event: string, callback: function): void
  • Unsubscribe to an event.

    Parameters

    • event: string

      The event name.

    • callback: function

      The exact same callback that was used when calling 'on'.

        • (event: string, properties: any, senderId: IdType): void
        • Parameters

          • event: string
          • properties: any
          • senderId: IdType

          Returns void

    Returns void

on

  • on(event: string, callback: function): void
  • Subscribe from an event.

    Parameters

    • event: string

      The event name.

    • callback: function

      a callback function which will be called each time the event occurs.

        • (event: string, properties: any, senderId: IdType): void
        • Parameters

          • event: string
          • properties: any
          • senderId: IdType

          Returns void

    Returns void

remove

  • remove(id: IdType | IdType[], senderId?: IdType): IdType[]
  • Remove one or more items by id.

    Parameters

    • id: IdType | IdType[]

      The item id.

    • Optional senderId: IdType

    Returns IdType[]

    Returns an array with the ids of the removed items.

setOptions

  • setOptions(options?: DataSetQueueOptions): void
  • Set options for the DataSet.

    Parameters

    • Optional options: DataSetQueueOptions

    Returns void

update

  • update(data: Edge | Edge[], senderId?: IdType): IdType[]
  • Update one or multiple existing items. When an item doesn't exist, it will be created.

    Parameters

    • data: Edge | Edge[]

      a single item or an array with items.

    • Optional senderId: IdType

    Returns IdType[]

    Returns an array with the ids of the updated items.