cytoscapejs

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 3 Imported by: 10

Documentation

Overview

Package cytoscapejs implements marshaling and unmarshaling of Cytoscape.js JSON documents.

See http://js.cytoscape.org/ for Cytoscape.js documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Data       EdgeData    `json:"data"`
	Selected   bool        `json:"selected,omitempty"`
	Selectable bool        `json:"selectable,omitempty"`
	Classes    string      `json:"classes,omitempty"`
	Scratch    interface{} `json:"scratch,omitempty"`
}

Edge is a Cytoscape.js edge.

type EdgeData

type EdgeData struct {
	ID         string
	Source     string
	Target     string
	Attributes map[string]interface{}
}

EdgeData is a graph edge's data container.

func (*EdgeData) MarshalJSON

func (e *EdgeData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*EdgeData) UnmarshalJSON

func (e *EdgeData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ElemData

type ElemData struct {
	ID         string
	Source     string
	Target     string
	Parent     string
	Attributes map[string]interface{}
}

ElemData is a graph element's data container.

func (*ElemData) MarshalJSON

func (e *ElemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*ElemData) UnmarshalJSON

func (e *ElemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ElemType

type ElemType int

ElemType describes an Element type.

const (
	InvalidElement ElemType = iota - 1
	NodeElement
	EdgeElement
)

type Element

type Element struct {
	Group            string      `json:"group,omitempty"`
	Data             ElemData    `json:"data"`
	Position         *Position   `json:"position,omitempty"`
	RenderedPosition *Position   `json:"renderedPosition,omitempty"`
	Selected         bool        `json:"selected,omitempty"`
	Selectable       bool        `json:"selectable,omitempty"`
	Locked           bool        `json:"locked,omitempty"`
	Grabbable        bool        `json:"grabbable,omitempty"`
	Classes          string      `json:"classes,omitempty"`
	Scratch          interface{} `json:"scratch,omitempty"`
}

Element is a mixed graph element.

func (Element) Type

func (e Element) Type() (ElemType, error)

Type returns the element type of the receiver. It returns an error if the Element Group is invalid or does not match the Element Data, or if the Element Data is an incomplete edge.

type Elements

type Elements struct {
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

Elements contains the nodes and edges of a GraphNodeEdge.

type GraphElem

type GraphElem struct {
	Elements []Element     `json:"elements"`
	Layout   interface{}   `json:"layout,omitempty"`
	Style    []interface{} `json:"style,omitempty"`
}

GraphElem is a Cytoscape.js graph with mixed graph elements.

type GraphNodeEdge

type GraphNodeEdge struct {
	Elements Elements      `json:"elements"`
	Layout   interface{}   `json:"layout,omitempty"`
	Style    []interface{} `json:"style,omitempty"`
}

GraphNodeEdge is a Cytoscape.js graph with separated nodes and edges.

type Node

type Node struct {
	Data             NodeData    `json:"data"`
	Position         *Position   `json:"position,omitempty"`
	RenderedPosition *Position   `json:"renderedPosition,omitempty"`
	Selected         bool        `json:"selected,omitempty"`
	Selectable       bool        `json:"selectable,omitempty"`
	Locked           bool        `json:"locked,omitempty"`
	Grabbable        bool        `json:"grabbable,omitempty"`
	Classes          string      `json:"classes,omitempty"`
	Scratch          interface{} `json:"scratch,omitempty"`
}

Node is a Cytoscape.js node.

type NodeData

type NodeData struct {
	ID         string
	Parent     string
	Attributes map[string]interface{}
}

NodeData is a graph node's data container.

func (*NodeData) MarshalJSON

func (n *NodeData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*NodeData) UnmarshalJSON

func (n *NodeData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Position

type Position struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Position is a node position.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL