React Sparkline API

The Sparkline UI component is a compact chart that contains only one series. Owing to their size, sparklines occupy very little space and can be easily collected in a table or embedded straight in text.

import Sparkline from "devextreme-react/sparkline"
Selector: Sparkline

View Demo Read Guides

See Also

Configuration

An object that specifies configuration properties for the Sparkline UI component.

Name Description
argumentField

Specifies the data source field that provides arguments for a sparkline.

barNegativeColor

Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only.

barPositiveColor

Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only.

dataSource

Binds the UI component to data.

disabled

Specifies whether the UI component responds to user interaction.

elementAttr

Specifies the global attributes to be attached to the UI component's container element.

firstLastColor

Sets a color for the boundary of both the first and last points on a sparkline.

ignoreEmptyPoints

Specifies whether the sparkline should ignore null data points.

lineColor

Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types.

lineWidth

Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types.

lossColor

Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only.

margin

Generates space around the UI component.

maxColor

Sets a color for the boundary of the maximum point on a sparkline.

maxValue

Specifies the maximum value of the sparkline's value axis.

minColor

Sets a color for the boundary of the minimum point on a sparkline.

minValue

Specifies the minimum value of the sparkline value axis.

onDisposing

A function that is executed before the UI component is disposed of.

onDrawn

A function that is executed when the UI component's rendering has finished.

onExported

A function that is executed after the UI component is exported.

onExporting

A function that is executed before the UI component is exported.

onFileSaving

A function that is executed before a file with exported UI component is saved to the user's local storage.

onIncidentOccurred

A function that is executed when an error or warning occurs.

onInitialized

A function used in JavaScript frameworks to save the UI component instance.

onOptionChanged

A function that is executed after a UI component property is changed.

onTooltipHidden

A function that is executed when a tooltip becomes hidden.

onTooltipShown

A function that is executed when a tooltip appears.

pathModified

Notifies the UI component that it is embedded into an HTML page that uses a tag modifying the path.

pointColor

Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types.

pointSize

Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types.

pointSymbol

Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types.

rtlEnabled

Switches the UI component to a right-to-left representation.

showFirstLast

Specifies whether or not to indicate both the first and last values on a sparkline.

showMinMax

Specifies whether or not to indicate both the minimum and maximum values on a sparkline.

size

Specifies the UI component's size in pixels.

theme

Sets the name of the theme the UI component uses.

tooltip

Configures the tooltip.

type

Determines the type of a sparkline.

valueField

Specifies the data source field that provides values for a sparkline.

winColor

Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only.

winlossThreshold

Specifies a value that serves as a threshold for the sparkline of the winloss type.

See Also

Methods

This section describes the methods that can be used in code to manipulate objects related to the Bullet UI component.

Name Description
beginUpdate()

Prevents the UI component from refreshing until the endUpdate() method is called.

dispose()

Disposes of all the resources allocated to the Sparkline instance.

element()

Gets the root UI component element.

endUpdate()

Refreshes the UI component after a call of the beginUpdate() method.

exportTo(fileName, format)

Exports the UI component.

getDataSource()

Gets the DataSource instance.

getInstance(element)

Gets the instance of a UI component found using its DOM node.

getSize()

Gets the current UI component size.

instance()

Gets the UI component's instance. Use it to access other methods of the UI component.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

option()

Gets all UI component properties.

option(optionName)

Gets the value of a single property.

option(optionName, optionValue)

Updates the value of a single property.

option(options)

Updates the values of several properties.

print()

Opens the browser's print window.

render()

Redraws the UI component.

resetOption(optionName)

Resets a property to its default value.

svg()

Gets the UI component's SVG markup.

See Also

Events

This section describes events fired by this UI component.

Name Description
disposing

Raised before the UI component is disposed of.

drawn

Raised when the UI component's rendering has finished.

exported

Raised after the UI component is exported.

exporting

Raised before the UI component is exported.

fileSaving

Raised before a file with exported UI component is saved to the user's local storage.

incidentOccurred

Raised when an error or warning occurs.

initialized

Raised only once, after the UI component is initialized.

optionChanged

Raised after a UI component property is changed.

tooltipHidden

Raised when a tooltip becomes hidden.

tooltipShown

Raised when a tooltip appears.

See Also