ui.chart

A tool for creating various charts.

The library supports the most common chart types:line, spline, area, bar, pie, donut, scatter, radar. You can customize appearance of a chart through colors, tooltips, templates, scales, labels. It's possible to present multiple data sets on the same chart. Check chart documentation for more detailed description.

Constructor

var chart = webix.ui({
    view:"chart",
    type:"bar",
    value:"#sales#",
    label:"#sales#",
    barWidth:35,
    radius:0,
    gradient:"falling",
    data: [
        { id:1, sales:20, year:"02"},
        { id:2, sales:55, year:"03"},
        { id:3, sales:40, year:"04"},
        { id:4, sales:78, year:"05"}
    ]
});

Where to start

Methods
add adds an item to the store
addSeries adds an additional graph to the chart
adjust adjusts the component to the size of the parent HTML container
attachEvent attaches the handler to an inner event of the component (allows behavior customizations)
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
clearCanvas clears the component canvas
count returns the number of currently visible items
define redefines a single configuration property (or a hash of 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 rows that match the criterion
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
getLastId returns the id of the last item
getNextId returns the ID of an item which is positioned the specified step after the specified item
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 which is positioned the specified step before the specified item
getTopParentView returns top parent view
group groups data by the specified data property
hasEvent checks whether the component has the specified event
hide hides the view
hideSeries hides the chosen graph in the chart with several graphs
isEnabled checks whether the view is enabled
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 to the defined parameters
refresh repaints the whole view or a certain item
remove removes the specified item/items from datastore
removeAllSeries removes all series from the chart
render renders the specified item or the whole component
resize adjusts the view to a new size
serialize serializes data to a JSON object
show makes the component visible
showSeries shows the hidden graph in the chart
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 blocking events that was enabled by the 'blockEvent' command
ungroup ungroups data
updateItem updates the data item with new properties
Events
onAfterAdd fires after adding item to datastore
onAfterContextMenu fires after the context menu was called in the item area
onAfterDelete fires after item deleting
onAfterLoad fires after data loading is complete
onAfterRender called after the rendering of calendar is complete.
onAfterScroll occurs when some webix view has been scrolled
onAfterSort fires after sorting dataset
onBeforeAdd fires before adding item to datastore
onBeforeContextMenu fires before the context menu is called in the item area
onBeforeDelete fires before item deleting
onBeforeLoad occurs immediately before data loading has been started
onBeforeRender occurs immediately before the component has been rendered
onBeforeSort fires before sorting dataset
onBindRequest fires when the component is ready to receive data from the master component
onBlur fires when focus is moved out of the view
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 data item is in update process
onDestruct occurs when component destroyed
onFocus fires when a view gets focus
onItemClick fires when a component item was clicked
onItemDblClick fires when a component item was double-clicked
onKeyPress occurs when keyboard key is pressed for the control in focus
onLoadError fires when an error occurs during data loading ( invalid server side response )
onLongTouch fires on holding finger in some position for a certain period of time
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
onSwipeX occurs on a horizontal swipe movement
onSwipeY occurs on a vertical swipe movement
onTimedKeyPress fires after typing has been finished in the field
onTouchEnd occurs when the touch event is ended
onTouchMove occurs during touch movement
onTouchStart when some webix view has been touched
onViewResize view size was changed by resizer
Properties
alpha defines the opacity of chart items
animate defines or disables view change animation.
animateDuration sets the time of rendering the area/line of one chart item in dynamic mode
ariaLabel sets a screen readable label for Chart
barWidth the width of bars
border enables/disables the bar borders
borderColor sets the border color of each item in the graph
borderless used to hide the component borders
cant defines the slope angle of 3D pie
cellWidth specifies the width of an item's cell for a chart in dynamic mode
color defines items colors
container an HTML container (or its id) where the component should be initialized
css the name of a css class 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
disableLines disapbles graph lines with radar chart
disabled indicates whether an item is enabled
dynamic enables the dynamic mode for a chart
eventRadius sets the radius (in pixels) of the virtual circle which events will fire for items within
fill fills the chart area with the specified background color.
fixOverflow chart max limit mode
gradient specifies the chart gradient
gravity sets the view gravity (1 by default)
height sets the height of the component
hidden defines whether the view will be hidden initially
id the component ID
item defines markers that present chart's data items
label sets the template for items' labels
labelOffset the offset of sector labels from the pie frame
legend defines the chart legend
line defines chart lines
lineColor sets the color for strips dividing the pie sectors
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
offset defines whether the first item of the scale will be drawn with the offset equal to the half of the scale's step (relative to the origin of the chart) or not.
on allows attaching custom handlers to inner events of the component
onClick attaches a click behavior for component items 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 behaviour for component items with the specified CSS class.
origin sets the scale origin
padding sets paddings of the chart content
pieHeight the height of the 3d pie
pieInnerText sets the template for the pie inner labels
preset applies the predefined chart configuration object with the specified name
radius the radius of the bar's rounding
ready event handler called just after the component has been completely initialized
removeMissed defines how to treat items in case of reloading
save defines URLs for data saving
scale type of chart scale, logarithic or plain
scheme defines schemes for data processing
series defines graphs presented on the chart
shadow enables/disables the pie shadow
tooltip sets a popup message appearing on pointing a mouse cursor over the dedicated item
type sets the chart type
url the URL which the component will use to load data after its initialization
value defines values for the vertical axis
width sets the width of the component
x the horizontal position of the pie center
xAxis defines the horizontal axis
xValue a property of the dataset that defines values for the horizontal axis
y the vertical position of the pie center
yAxis defines the vertical axis
yValue a property of the dataset that defines values for the vertical axis.
Other
$getSize returns the current size of the component
$height current height of the view
$scope scope for resolving event and method names
$setSize sets the component size
$skin the method which will be called when skin is defined
$view reference to top html element of the view
$width current width of the view
colormap collection of coloring strategies
config all options from 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 the DataTable cells
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
presets collection of styling presets
waitData eventual result of an asynchronous operation ('promise' object) for the loaded data
Back to top