ui.diagram

Since 8.3

A powerful widget for building graphs.

Diagram is an advanced tool designed for building diagrams of any complexity. It is extended with the predefined set of types, but also allows creating custom SVG-based shapes. Links and blocks can be arranged automatically or be at the fixed coordinates.

Constructor

webix.ui({
  view:"diagram",
  data: [
    { id: "1", value: "Block 1", type: "plus"}
  ],
});

Where to start

Methods
add adds an item to the store
addCss applied CSS class to a component item
addShape adds a custom SVG-based shape to Diagram
adjust adjusts the component to the size of the parent HTML container
adjustItem adjust width/height of a specified block to its content
attachEvent attaches the handler to an inner event of the component
autoPlace enabled/disables autoplacement of blocks
bind binds components
blockEvent temporarily blocks triggering of ALL events of the calling object
callEvent calls an inner event
clearAll removes all items from the component
clearCss removes CSS class from all items
count returns the number of currently visible items
customize redefines the "item" property
define redefines a single configuration property (or a object with properties)
destructor destructs the calling object
detachEvent detaches a handler from an event (which was attached before by the attachEvent method)
disable disables the calling view (makes it dimmed and unclickable)
enable enables the calling view that was disabled by the 'disable' method
exists checks whether an item with the specified ID exists
filter filters the component
find returns all rows that match the criterion, or only the first one
getChildViews returns child views of the calling component
getFirstId returns the ID of the first item
getFormView returns master form for the input
getIdByIndex returns the ID of the item with the specified index
getIndexById returns the index of the item with the specified ID
getItem gets the object of the data item with the specified ID
getItemNode returns HTML element of the item
getItemValue returns the value of a specified object field
getLastId returns the ID of the last item
getLinkItemNode returns HTML element of the link
getLinks returns a collection of Diagram links
getNextId returns the ID of an item that is after the specified item, either directly after or after a number of items (defined by the step)
getNode returns the main HTML container for the calling object
getParentView returns the parent view of the component
getPrevId returns the ID of an item that is before the specified item, either directly before or before a number of items (defined by the step)
getScrollState returns the scroll position
getSelectedId returns the id(s) of the selected item(s)
getSelectedItem returns selected object
getShape returns the data object of a specified shape
getShapes returns a collection of shapes
getTopParentView returns the top parent view
hasCss checks if item has specific css class
hasEvent checks whether the component has the specified event handler
hide hides the view
isCurveLink checks whether the provided link is curved
isEnabled checks whether the view is enabled
isSelected checks whether the specified item is selected or not
isVisible checks whether the view is visible
load loads data from an external data source
loadNext sends a request to load the specified number of records to the end of the client-side dataset or to the specified position
locate gets the ID of an item from the specified HTML event
mapEvent routes events from one object to another
parse loads data to the component from an inline data source
queryView returns inner element/elements of a widget that correspond(s) to the defined parameters
refresh repaints the whole view or a certain item
remove removes the specified item/items from datastore
removeCss removes CSS class from a component item
render renders the specified item or the whole component
resize adjusts the view to a new size
scrollTo scrolls the data container to a certain position
select selects the specified item(s)
selectAll selects all items or the specified range
serialize serializes data to an array of JSON objects
setShape defines styles for a specified shape
show makes the component visible
sort sorts datastore
sync allows syncing two copies of data (all or just a part of it) from one DataCollection to another
unbind breaks "bind" link
unblockEvent cancels events blocking that was enabled by the 'blockEvent' command
unselect removes selection from the specified item
unselectAll removes selection from all items
updateItem updates the data item with new properties
waitSave allows to catch the moment when a data operation was saved to the server
Events
onAfterAdd fires after adding an item to the datastore
onAfterContextMenu fires after the context menu was called in the item area
onAfterDelete fires after an item is removed
onAfterLoad fires after data loading is complete
onAfterRender occurs immediately after the component has been rendered
onAfterScroll fires when to component is scrolled in any direction
onAfterSelect fires after item was selected
onAfterSort fires after sorting dataset
onBeforeAdd fires before adding an item to the datastore
onBeforeContextMenu fires before the context menu is called in the item area
onBeforeDelete fires before an item is removed
onBeforeLoad fires immediately before data loading has started
onBeforeRender occurs immediately before the component has been rendered
onBeforeSelect fires before item selection is started
onBeforeSort fires before sorting of the dataset
onBindRequest fires when the component is ready to receive data from the master component
onDataRequest fires when data from the server is requested for linear data structures (List, DataTable, DataView etc.) to implement dynamic data loading
onDataUpdate fires when a data item is being updated
onDestruct occurs when component destroyed
onItemClick fires when a component item was clicked
onItemDblClick fires when a component item was double-clicked
onItemRender for each item rendering, occurs only for items with custom templates
onItemSingleClick allows distinguishing between single and double-click events
onLoadError fires when an error occurs during data loading (invalid server side response)
onMouseMove fires when the mouse was moved over the specified component
onMouseMoving fires when the mouse was moved over the component
onMouseOut fires when the mouse was moved out from the specified item
onSelectChange fires after selection state was changed
onViewShow fires when any hidden view is shown
Properties
animate defines the type of animation, with which the view is shown, if it is a Multiview cell
ariaLabel sets a screen readable label for Diagram
autoplace defines whether to place blocks automatically
borderless used to hide the component borders
container an HTML container (or its ID) where the component should be initialized
css the name of the CSS class or the object with styles that will be applied to the view container
data JavaScript array containing data for the component
datathrottle sets the polling interval (the time period between the completion of a network request and the next request for data)
datatype the type of loaded data
disabled indicates whether an item is enabled
gravity sets the view gravity
height sets the height of the component
hidden defines whether the view will be hidden initially
id the ID of a widget
item an object with defaults for Diagram elements
linkItem an object that specifies links presentation
linkType alias to the linkItem property
links links data source
maxHeight sets the maximum height for the view
maxWidth sets the maximum width for the view
minHeight sets the minimal height for the view
minWidth sets the minimal width for the view
mouseEventDelay the delay between a real mouse action and invoking the related events
multiselect enables multiselect mode
on allows attaching custom handlers to inner events of the component
onClick attaches a click handler for component parts with the specified CSS class
onContext a property used to define custom context-click (right click) handlers for elements in the DataTable cells
onDblClick attaches a dblclick behavior for component items with the specified CSS class.
onMouseMove attaches a mousemove behavior for component items with the specified CSS class.
padding spacing between diagram border and its contents
ready the event handler is called just after the component has been completely initialized
removeMissed defines how to treat items in case of reloading
root defines ID of the root item for autoplacement
save defines URLs for data saving
scheme defines schemes for data processing
scroll enables/disables the scroll bar
scrollSpeed the time during which the component is scrolled to the specified position (in milliseconds)
select enables/disables items selection or multiselection in widgets
shapes stores configuration of Diagram shapes
template the component template
tooltip sets a popup message next to the item when the cursor points to it
treePadding defines padding between separate trees, if any
type alias to the item property
url the URL which the component will use to load data after its initialization
width sets the width of a widget
zoom defines the current zoom level
Other
$getSize returns the current size of the component
$height the current height of the view
$onLoad default action on data loading
$setNode defines HTML element for the component
$setSize sets the component size
$skin the method which will be called when skin is defined
$tooltipIn shows a tooltip
$tooltipMove defines the tooltip while the cursor moves over a view or an HTML area
$tooltipOut defines the behavior of a tooltip when the cursor is out of the target widget or HTML area
$view reference to the top HTML element of the view
$width the current width of the view
config all options from the initial component configuration
data inner DataStore
name indicates the name of the component (a read-only property)
on_click redefines default click behavior for component items.
on_context a property used to define custom context-click (right click) handlers for elements in widgets
on_dblclick attaches a dblclick behavior for component items with the specified CSS class
on_mouse_move attaches a mouse move behavior for component items with the specified CSS class
waitData eventual result of an asynchronous operation ('promise' object) for the loaded data
Back to top