Configuration

An object that specifies configuration options for the dxSparkline widget.

argumentField

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

Type: String
Default Value: 'arg'

Show Example:
jQuery

In this example, arguments for the sparkline are provided by the 'month' field of the data source using the argumentField option.


                                    

                                    

barNegativeColor

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

Type: String
Default Value: '#d7d7d7'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

To set a color for the bars indicating positive values, specify the barPositiveColor option.

Show Example:
jQuery

In this example, the data source contains both negative and positive values. The negative values are painted 'coral' using the barNegativeColor option while the positive values are painted 'powderblue' using the barPositiveColor option.


                                    

                                    

barPositiveColor

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

Type: String
Default Value: '#a9a9a9'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

To set a color for the bars indicating negative values, specify the barNegativeColor option.

Show Example:
jQuery

In this example, the data source contains both positive and negative values. The positive values are painted 'dodgerblue' using the barPositiveColor option while the negative values are painted 'salmon' using the barNegativeColor option.


                                    

                                    

dataSource

Specifies a data source for the sparkline.

Type: Array
Cannot be used in themes.

To provide data for a sparkline, introduce an array of objects. These objects should contain a field that represents an argument and a field that represents the value corresponding to that argument. Assign this array to the dataSource field. After that, specify which data source field to use as a source for arguments and which one as a source for values using the argumentField and valueField options.

Show Example:
jQuery

In this example, the data source is declared as an array of objects, each of which contains the 'month' and '2010' fields. The 'month' field provides arguments for the sparkline, while the '2010' field provides values.


                                    

                                    

drawn

Deprecated

Use the onDrawn option instead.

firstLastColor

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

Type: String
Default Value: '#666666'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

Make sure that the showFirstLast option is set to true, so that this option takes effect.

To specify a color for the area inside of the point boundary, use the pointColor option.

Show Example:
jQuery

In this example, the first and last sparkline values are indicated by points colored in 'lightskyblue'.


                                    

                                    

ignoreEmptyPoints

Specifies whether a sparkline ignores null data points or not.

Type: Boolean
Default Value: false

By default, if a data source has data points with a null argument or value, a sparkline may draw series with unnecessary gaps between points. To prevent this behavior from occurring, set the ignoreEmptyPoints option to true.

incidentOccured

Deprecated

Use the onIncidentOccurred option instead.

lineColor

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

Type: String
Default Value: '#666666'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)
Show Example:
jQuery

In this example, the line of the steparea sparkline is colored in 'lightgreen' using the lineColor option.


                                    

                                    

lineWidth

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

Type: Number
Default Value: 2

Show Example:
jQuery

In this example, the line of the area sparkline is increased up to a 4-pixel width using the lineWidth option.


                                    

                                    

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.

Type: String
Default Value: '#d7d7d7'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

To set a color for the bars indicating the values greater than a winloss threshold, specify the winColor option.

Show Example:
jQuery

In this example, all the 'loss' bars are drawn in the 'orange' color using the lossColor option.


                                    

                                    

margin

Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels.

Type: Object

Set the required values for the left, right, top and bottom margins using the corresponding options of the margin object.

maxColor

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

Type: String
Default Value: '#e55253'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

So that this option takes effect, make sure that the showMinMax option is set to true.

To set a color for the minimum point on a sparkline, specify the minColor option.

To specify a color for the area inside of the point boundary, use the pointColor option.

Show Example:
jQuery

In this example, the maximum value on the sparkline is painted red using the maxColor option.


                                    

                                    

minColor

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

Type: String
Default Value: '#e8c267'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

Make sure that the showMinMax option is set to true, so that this option takes effect.

To set a color for the maximum point on a sparkline, specify the maxColor option.

To specify a color for the area inside of the point boundary, use the pointColor option.

Show Example:
jQuery

In this example, the minimum value on the sparkline is painted blue using the minColor option.


                                    

                                    

onDisposing

A handler for the disposing event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element.
Default Value: null

Assign a function to perform a custom action when you dispose of this component.

onDrawn

A handler for the drawn event.

Type: function(e)
Function parameters:
e: Object
Information about the event.
Object structure:
component: Object
The widget instance.
element: Object
The widget's container.
Cannot be used in themes.

If you need to perform specific actions when the widget has finished drawing itself, assign a callback function to the drawn option. When implementing this function, you can access the drawn widget using the function's parameter.

onIncidentOccurred

A handler for the incidentOccurred event.

Type: function(e)
Function parameters:
e: Object
Information about the event.
Object structure:
component: Object
The widget instance.
element: Object
The widget's container.
target: Object
Information about the occurred incident.

When an error or warning appears, the widget notifies you by passing a message to the browser console. This message contains the ID of the incident, a brief description, and a link to the Errors and Warnings section where further information about this incident can be found. However, you can handle errors and warnings in the way that you require. To do this, implement a callback function performing the required actions and assign it to the onIncidentOccurred option. Within this function, you can use information about the incident that occurred. This information can be accessed from the target field of the object passed to the callback function as a parameter. This information includes the following.

  • id
    Contains the ID of the incident. The full list of IDs can be found in the Errors and Warnings section.
  • type
    Contains the type of the incident. This field equals 'error' for errors or 'warning' for warnings.
  • args
    Contains the argument of the incident's message. The content of this field varies greatly, depending on the incident. For example, it may contain the name of the data source field that was not specified correctly, or the name of the option that was not set properly.
  • text
    Contains the text passed to the browser console. This text includes the content of the args field, if there are any.
  • widget
    Contains the name of the widget that produced the error or warning.
  • version
    Contains the currently used version of the ChartJS library.

onOptionChanged

A handler for the optionChanged event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element.
value: any
Specifies a new value for the option.
Default Value: null

Assign a function to perform a custom action after an option of the component is changed.

pathModified

Notifies a widget that it is embedded into an HTML page that uses a path modifier.

Type: Boolean
Default Value: false
Cannot be used in themes.

If you place a widget on a page that uses a path modifier, notify the widget about it by setting the pathModified option to true. As an example of such modifiers, the base HTML tag can be considered. Also, we recommend you enable this option if you place the widget inside the <iframe> tag.

pointColor

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

Type: String
Default Value: '#ffffff'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)
Show Example:
jQuery

In this example, the points are drawn in the 'papayawhip' color using the pointColor option.


                                    

                                    

pointSize

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

Type: Number
Default Value: 4

Show Example:
jQuery

In this example, the points are increased in size using the pointSize option.


                                    

                                    

pointSymbol

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

Type: String
Default Value: 'circle'
Accepted Values: 'circle' | 'square' | 'polygon' | 'triangle' | 'cross'

Show Example:
jQuery

Use the drop-down menu below to select the symbol representing the sparkline points.


                                    

                                    

rtlEnabled

Specifies whether or not the widget supports right-to-left representation.

Type: Boolean
Default Value: false
Cannot be used in themes.

The most common scenario is switching all the widgets to a right-to-left reading order. In this instance, set the DevExpress.rtlEnabled field to true. If you need to switch the reading order in a particular widget, use the rtlEnabled configuration option of this widget.

showFirstLast

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

Type: Boolean
Default Value: true

When this option is set to true, the first and last values are highlighted and painted in the color specified by the firstLastColor option.

Show Example:
jQuery

Toggle the check box below to show/hide the first and last points on the sparkline.


                                    

                                    

showMinMax

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

Type: Boolean
Default Value: false

When this option is set to true, the minimum and maximum values are highlighted and painted in the colors specified by the minColor and maxColor options correspondingly.

Show Example:
jQuery

Toggle the check box below to show/hide the minimum and maximum points on the sparkline.


                                    

                                    

size

Specifies the size of the widget.

Type: Object

By default, the widget occupies the entire area of the parent container (division). If the container width or height is set to zero, the widget is not displayed.

If you need to set a particular size for the widget, different from the container's size, use the size configuration object. Assign a height and width in pixels to the height and width options of the size object.

NOTE: The size configuration object reserves space for the main widget elements, while displaying a tooltip may require extra space. Refer to the tooltip object description to find ways to resolve this issue.

Show Example:
jQuery

In this example, the size of the widget differs from the container size.


                                    

                                    

theme

Specifies the name of the theme to be applied.

Type: String
Default Value: 'desktop'

Use this option to specify the name of the theme that should be applied to the widget. For information on customizing and implementing themes, refer to the Themes topic.

Show Example:
jQuery

In this example, a blue theme is implemented on the base of the default theme. This theme is applied to the dxSparkline widget using the theme option.


                                    

                                    

tooltip

Specifies tooltip options.

Type: Object

A tooltip is a small pop-up rectangle that displays information about a widget when it is hovered over. You can enable or disable a tooltip, change its default appearance and format or customize the displayed text using the options of the tooltip configuration object.

NOTE: A tooltip is displayed outside the widget's container. If you plan to use the tooltip, make sure there is enough space around your widget to display it. For example, you can apply a margin to the widget's container to reserve the area around the widget for the tooltip.

View Demo

Show Example:
jQuery

In this example, several tooltip options are altered. The tooltip is colored in 'lavender' using the tooltip's color option. In addition, the tooltip text is painted blue and displayed with a size of 12.


                                    

                                    

type

Determines the type of a sparkline.

Type: String
Default Value: 'line'
Accepted Values: 'line' | 'spline' | 'stepline' | 'area' | 'splinearea' | 'steparea' | 'bar' | 'winloss'

A sparkline type determines the visual representation of data. Different options of the dxSparkline widget are available for different types. The table below reflects options that can be configured for the sparkline of a certain type.

line spline stepline area splinearea steparea bar winloss
  • argumentField
  • dataSource
  • firstLastColor
  • lineColor
  • lineWidth
  • minColor
  • maxColor
  • pointColor
  • pointSize
  • pointSymbol
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • dataSource
  • firstLastColor
  • lineColor
  • lineWidth
  • minColor
  • maxColor
  • pointColor
  • pointSize
  • pointSymbol
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • dataSource
  • firstLastColor
  • lineColor
  • lineWidth
  • minColor
  • maxColor
  • pointColor
  • pointSize
  • pointSymbol
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • dataSource
  • firstLastColor
  • lineColor
  • lineWidth
  • minColor
  • maxColor
  • pointColor
  • pointSize
  • pointSymbol
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • dataSource
  • firstLastColor
  • lineColor
  • lineWidth
  • minColor
  • maxColor
  • pointColor
  • pointSize
  • pointSymbol
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • dataSource
  • firstLastColor
  • lineColor
  • lineWidth
  • minColor
  • maxColor
  • pointColor
  • pointSize
  • pointSymbol
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • barNegativeColor
  • barPositiveColor
  • dataSource
  • firstLastColor
  • minColor
  • maxColor
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • argumentField
  • dataSource
  • firstLastColor
  • lossColor
  • minColor
  • maxColor
  • showFirstLast
  • showMinMax
  • size
  • theme
  • tooltip
  • valueField
  • winColor
  • winlossThreshold

To see the sparklines of each type in operation, refer to our Visualization Gallery.

valueField

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

Type: String
Default Value: 'val'

Show Example:
jQuery

In this example, values for the sparkline are provided by the '2010' field of the data source using the valueField option.


                                    

                                    

winColor

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

Type: String
Default Value: '#a9a9a9'

This option supports the following colors.

  • Hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • Predefined/cross-browser color names
  • Predefined SVG colors (not supported in Internet Explorer 8)

To set a color for the bars indicating the values that are less than the winloss threshold, specify the lossColor option.

Show Example:
jQuery

In this example, all the 'win' bars are drawn in the 'palevioletred' color using the winColor option.


                                    

                                    

winlossThreshold

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

Type: Number
Default Value: 0

In the winloss sparkline, values are represented by bars that either grow up or go down from an invisible line. This line is determined by a threshold value. If a data source value is greater than this threshold value, the bar grows up. Otherwise, it goes down.

You can paint the 'win' and 'loss' bars differently. For this purpose, specify the required colors using the winColor and lossColor options respectively.

Show Example:
jQuery

In this example, the winlossThreshold option is set to 2100. It means that the values greater than 2100 are represented by bars growing up from the threshold line while the other values are represented by bars going down from this line.