barNegativeColor
Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
To set a color for the bars indicating positive values, specify the barPositiveColor option.
barPositiveColor
Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
To set a color for the bars indicating negative values, specify the barNegativeColor option.
dataSource
This option accepts one of the following.
Array of objects
A simple JavaScript array containing a collection of plain objects.URL
A URL to JSON data or to a service returning data in JSON format.DataSource or its configuration object
A DataSource is an object that provides a handy API for data processing. A DataSource is a stateful object, which means that it saves data processing settings and applies them each time data is loaded. All underlying data access logic of a DataSource is isolated in a Store. A Store provides an API for reading and modifying data. Unlike the DataSource, a Store is a stateless object.
.
, ,
, :
, [
, and ]
. Their presence may cause issues in the widget's operation.See Also
elementAttr
Specifies the attributes to be attached to the widget's root element.
You can configure this option in an ASP.NET MVC Control as follows:
@(Html.DevExtreme().WidgetName() .ElementAttr("class", "class-name") // ===== or ===== .ElementAttr(new { @id = "elementId", @class = "class-name" }) // ===== or ===== .ElementAttr(new Dictionary<string, object>() { { "id", "elementId" }, { "class", "class-name" } }) )
@(Html.DevExtreme().WidgetName() _ .ElementAttr("class", "class-name") ' ===== or ===== .ElementAttr(New With { .id = "elementId", .class = "class-name" }) ' ===== or ===== .ElementAttr(New Dictionary(Of String, Object) From { { "id", "elementId" }, { "class", "class-name" } }) )
firstLastColor
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
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.
lineColor
Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
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.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
To set a color for the bars indicating the values greater than a winloss threshold, specify the winColor option.
maxColor
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
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.
minColor
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
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.
onDisposing
A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onDrawn
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onExported
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onExporting
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
|
fileName |
The name of the file to which the widget is about to be exported. |
|
cancel |
Allows you to prevent exporting. |
|
format |
The resulting file format. One of PNG, PDF, JPEG, SVG and GIF. |
onFileSaving
A handler for the fileSaving event. Executed before a file with exported data is saved on the user's local storage.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
fileName |
The name of the file to be saved. |
|
format |
The format of the file to be saved. |
|
data |
Exported data as a BLOB. |
|
cancel |
Allows you to prevent file saving. |
onIncidentOccurred
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
|
target | any |
Information on 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 DevExtreme library.
onInitialized
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
You cannot access widget elements in this handler because it is executed before they are ready. Use the onDrawn handler instead.
onOptionChanged
Name | Type | Description |
---|---|---|
name |
The option's short name. |
|
model |
The model data. Available only if you use Knockout. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The widget's instance. |
|
fullName |
The option's full name. |
|
value | any |
The option's new value. |
onTooltipHidden
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
The sparkline's tooltip becomes invisible when a user moves the mouse cursor outside of the widget.
When a tooltip is made hidden, you can perform specific actions by handling the tooltipHidden event. To do this, implement a handling function and assign it to this option. When implementing a handling function, use the object passed to it as its parameter. This object will provide you with the widget instance and its container.
onTooltipShown
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
The sparkline's tooltip appears when a user hovers the mouse cursor over it.
When a tooltip appears, you can perform specific actions by handling the tooltipShown event. To do this, implement a handling function and assign it to this option. When implementing this function, use the object passed to it as its parameter. This object will provide you with the widget instance and its container.
pathModified
pointColor
Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
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.
When using the widget as an ASP.NET MVC Control, specify this option using the VizPointSymbol
enum. This enum accepts the following values: Circle
, Square
, Polygon
, Triangle
and Cross
.
rtlEnabled
When this option is set to true, the widget text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.
DevExpress.config({ rtlEnabled: true });
showFirstLast
When this option is set to true, the first and last values are highlighted and painted in the color specified by the firstLastColor option.
size
By default, the widget occupies the entire area of the container. If you need to set a particular size for the widget, different from the container's size, assign a height and width in pixels to height and width properties of the size object.
Using the size object, you can hide the widget. For this purpose, simply assign 0 to both the height and width of the widget.
theme
A theme is a widget configuration that gives the widget a distinctive appearance. Use can use one of the predefined themes or create a custom one. Changing the option values in the widget's configuration object overrides the theme's corresponding values.
When using the widget as an ASP.NET MVC Control, specify this option using the VizTheme
enum. This enum accepts the following values: GenericLight
, GenericDark
, GenericContrast
, GenericCarmine
, GenericDarkMoon
, GenericSoftBlue
, GenericDarkViolet
, GenericGreenMist
, Android5Light
, IOS7Default
, Win10Black
and Win10White
.
tooltip
A tooltip is a miniature rectangle displaying widget data. The tooltip appears when the end-user hovers the cursor over the widget. You can enable/disable the tooltip, change its appearance and format its text using fields of the tooltip configuration object.
type
A sparkline type determines the visual representation of data. Different options of the Sparkline 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 |
---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
To see the sparklines of each type in operation, refer to our Visualization Gallery.
When using the widget as an ASP.NET MVC Control, specify this option using the SparklineType
enum. This enum accepts the following values: Line
, Spline
, StepLine
, Area
, SplineArea
, StepArea
, Bar
and WinLoss
.
View Area Sparkline Demo View Bar Sparkline Demo View Winloss Sparkline Demo
winColor
Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
To set a color for the bars indicating the values that are less than the winloss threshold, specify the lossColor option.
winlossThreshold
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.
If you have technical questions, please create a support ticket in the DevExpress Support Center.