A newer version of this page is available. Switch to the current version.

jQuery Sparkline Options

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

argumentField

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

Type:

String

Default Value: 'arg'

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 property supports the following colors:

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

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 property supports the following colors:

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

dataSource

Binds the UI component to data.

Cannot be used in themes.

The Sparkline works with collections of objects.

Depending on your data source, bind the Sparkline to data as follows. In each case, also specify the argumentField and valueField properties.

  • Data Array
    Assign the array to the dataSource option. View Demo

  • Read-Only Data in JSON Format
    Set the dataSource property to the URL of a JSON file or service that returns JSON data.

  • OData
    Implement an ODataStore.

  • Web API, PHP, MongoDB
    Use one of the following extensions to enable the server to process data according to the protocol DevExtreme UI components use:

    Then, use the createStore method to configure access to the server on the client as shown below. This method is part of DevExtreme.AspNet.Data.

    jQuery
    JavaScript
    $(function() {
        let serviceUrl = "https://url/to/my/service";
        $("#sparklineContainer").dxSparkline({
            // ...
            dataSource: DevExpress.data.AspNet.createStore({
                key: "ID",
                loadUrl: serviceUrl + "/GetAction",
                insertUrl: serviceUrl + "/InsertAction",
                updateUrl: serviceUrl + "/UpdateAction",
                deleteUrl: serviceUrl + "/DeleteAction"
            })
        })
    });
    Angular
    app.component.ts
    app.component.html
    app.module.ts
    import { Component } from '@angular/core';
    import CustomStore from 'devextreme/data/custom_store';
    import { createStore } from 'devextreme-aspnet-data-nojquery';
    
    @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.css']
    })
    export class AppComponent {
        store: CustomStore;
        constructor() {
            let serviceUrl = "https://url/to/my/service";
            this.store = createStore({
                key: "ID",
                loadUrl: serviceUrl + "/GetAction",
                insertUrl: serviceUrl + "/InsertAction",
                updateUrl: serviceUrl + "/UpdateAction",
                deleteUrl: serviceUrl + "/DeleteAction"
            })
        }
    }
    <dx-sparkline ...
        [dataSource]="store">
    </dx-sparkline>
    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { AppComponent } from './app.component';
    
    import { DxSparklineModule } from 'devextreme-angular';
    
    @NgModule({
        declarations: [
            AppComponent
        ],
        imports: [
            BrowserModule,
            DxSparklineModule
        ],
        providers: [],
        bootstrap: [AppComponent]
    })
    export class AppModule { }
    Vue
    App.vue
    <template> 
        <DxSparkline ...
            :data-source="store" />
    </template>
    
    <script>
    import 'devextreme/dist/css/dx.light.css';
    
    import CustomStore from 'devextreme/data/custom_store';
    import { createStore } from 'devextreme-aspnet-data-nojquery';
    import { DxSparkline } from 'devextreme-vue/sparkline';
    
    export default {
        components: {
            DxSparkline
        },
        data() {
            const serviceUrl = "https://url/to/my/service";
            const store = createStore({
                key: "ID",
                loadUrl: serviceUrl + "/GetAction",
                insertUrl: serviceUrl + "/InsertAction",
                updateUrl: serviceUrl + "/UpdateAction",
                deleteUrl: serviceUrl + "/DeleteAction"
            });
            return {
                store
            }
        }
    }
    </script>
    React
    App.js
    import React from 'react';
    import 'devextreme/dist/css/dx.light.css';
    
    import CustomStore from 'devextreme/data/custom_store';
    import { createStore } from 'devextreme-aspnet-data-nojquery';
    import Sparkline from 'devextreme-react/sparkline';
    
    const serviceUrl = "https://url/to/my/service";
    const store = createStore({
        key: "ID",
        loadUrl: serviceUrl + "/GetAction",
        insertUrl: serviceUrl + "/InsertAction",
        updateUrl: serviceUrl + "/UpdateAction",
        deleteUrl: serviceUrl + "/DeleteAction"
    });
    
    class App extends React.Component {
        render() {
            return (
                <Sparkline ...
                    dataSource={store} />
            );
        }
    }
    export default App;
  • Any other data source
    Implement a CustomStore.

Regardless of the data source on the input, the Sparkline always wraps it in the DataSource object. This object allows you to sort, filter, group, and perform other data shaping operations. To get its instance, call the getDataSource() method.

NOTE

Review the following notes about data binding:

  • Data field names cannot be equal to this and should not contain the following characters: ., :, [, and ].
jQuery
  • The stores are immutable. You cannot change their configurations at runtime. Instead, create a new store or DataSource and assign it to the dataSource property as shown in the following help topic: Get and Set Properties.
Angular
  • The stores are immutable. You cannot change their configurations at runtime. Instead, create a new store or DataSource and assign it to the dataSource property as shown in the following help topic: Two-Way Property Binding.
Vue
  • The stores are immutable. You cannot change their configurations at runtime. Instead, create a new store or DataSource and assign it to the dataSource property as shown in the following help topic: Two-Way Property Binding.
React
  • The stores are immutable. You cannot change their configurations at runtime. Instead, create a new store or DataSource and assign it to the dataSource property as shown in the following help topic: Controlled Mode.

disabled

Specifies whether the UI component responds to user interaction.

Type:

Boolean

Default Value: false
Cannot be used in themes.

elementAttr

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

Type:

Object

Default Value: {}

jQuery
$(function(){
    $("#sparklineContainer").dxSparkline({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-sparkline ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-sparkline>
import { DxSparklineModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxSparklineModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxSparkline ...
        :element-attr="sparklineAttributes">
    </DxSparkline>
</template>

<script>
import DxSparkline from 'devextreme-vue/sparkline';

export default {
    components: {
        DxSparkline
    },
    data() {
        return {
            sparklineAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import Sparkline from 'devextreme-react/sparkline';

class App extends React.Component {
    sparklineAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <Sparkline ...
                elementAttr={this.sparklineAttributes}>
            </Sparkline>
        );
    }
}
export default App;

firstLastColor

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

Type:

String

Default Value: '#666666'

This property supports the following colors:

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

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

ignoreEmptyPoints

Specifies whether the sparkline should ignore null data points.

Type:

Boolean

Default Value: false

Data points that have the null value do not produce actual points. Because of this, the sparkline may be drawn with unnecessary gaps where missing points should have been. To remove these gaps, set the ignoreEmptyPoints property to true.

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 property supports the following colors:

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

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 property supports the following colors:

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

margin

Generates space around the UI component.

Type:

Object

WidgetMargin DevExtreme ChartJS

jQuery
index.js
$(function() {
    $("#sparklineContainer").dxSparkline({
        // ...
        margin: {
            top: 20,
            bottom: 20,
            left: 30,
            right: 30
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-sparkline ... >
    <dxo-margin
        [top]="20"
        [bottom]="20"
        [left]="30"
        [right]="30">
    </dxo-margin>
</dx-sparkline>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxSparklineModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxSparklineModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxSparkline ... >
        <DxMargin
            :top="20"
            :bottom="20"
            :left="30"
            :right="30"
        />
    </DxSparkline>
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import DxSparkline, {
    DxMargin 
} from 'devextreme-vue/sparkline';

export default {
    components: {
        DxSparkline,
        DxMargin
    },
    // ...
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.light.css';

import Sparkline, {
    Margin 
} from 'devextreme-react/sparkline';

class App extends React.Component {
    render() {
        return (
            <Sparkline ... >
                <Margin
                    top={20}
                    bottom={20}
                    left={30}
                    right={30}
                />
            </Sparkline>
        );
    }
}
export default App;

maxColor

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

Type:

String

Default Value: '#e55253'

This property supports the following colors:

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

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

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

maxValue

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

Type:

Number

Default Value: undefined

minColor

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

Type:

String

Default Value: '#e8c267'

This property supports the following colors:

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

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

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

minValue

Specifies the minimum value of the sparkline value axis.

Type:

Number

Default Value: undefined

onDisposing

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only if you use Knockout.

Default Value: null

onDrawn

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

Default Value: null
Cannot be used in themes.

onExported

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

Default Value: null

onExporting

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

fileName

String

The name of the file to which the UI component is about to be exported.

format

String

The resulting file format. One of PNG, PDF, JPEG, SVG and GIF.

model any

The model data. Available only if you use Knockout.

Default Value: null

onFileSaving

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
cancel

Boolean

Allows you to prevent file saving.

component

Sparkline

The UI component's instance.

data

BLOB

Exported data as a BLOB.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

fileName

String

The name of the file to be saved.

format

String

The format of the file to be saved.
Possible Values: 'PNG' | 'PDF' | 'JPEG' | 'SVG' | 'GIF'

Default Value: null

onIncidentOccurred

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

target any

Information on the occurred incident.

Default Value: null

The UI component notifies you of errors and warnings by passing messages to the browser console. Each message contains the incident's ID, a brief description, and a link to the Errors and Warnings section where further information about this incident can be found.

The onIncidentOccurred function allows you to handle errors and warnings the way you require. The object passed to it contains the target field. This field provides information about the occurred incident and contains the following properties:

  • id
    The incident's ID. The full list of IDs can be found in the Errors and Warnings section.
  • type
    The incident's type: "error" or "warning".
  • args
    The argument of the incident's message. Depends on the incident. For example, it may be the name of the data source field that was specified incorrectly, or the name of the property that was not set properly.
  • text
    The text passed to the browser's console. Includes the args content, if there is any.
  • widget
    The name of the UI component that produced the error or warning.
  • version
    The used DevExtreme version.

onInitialized

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

Default Value: null

onOptionChanged

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
model any

Model data. Available only if you use Knockout.

fullName

String

The path to the modified property that includes all parent properties.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Sparkline

The UI component's instance.

name

String

The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into.

value any

The modified property's new value.

previousValue any

The UI component's previous value.

Default Value: null

The following example shows how to subscribe to component property changes:

jQuery
index.js
$(function() {
    $("#sparklineContainer").dxSparkline({
        // ...
        onOptionChanged: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-sparkline ...
    (onOptionChanged)="handlePropertyChange($event)"> 
</dx-sparkline>
import { Component } from '@angular/core'; 

@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'] 
}) 

export class AppComponent { 
    // ...
    handlePropertyChange(e) {
        if(e.name === "changedProperty") { 
            // handle the property change here
        }
    }
}
import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 
import { AppComponent } from './app.component'; 
import { DxSparklineModule } from 'devextreme-angular'; 

@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule, 
        DxSparklineModule 
    ], 
    providers: [ ], 
    bootstrap: [AppComponent] 
}) 

export class AppModule { }  
Vue
App.vue
<template> 
    <DxSparkline ...
        @option-changed="handlePropertyChange"
    />            
</template> 

<script>  
import 'devextreme/dist/css/dx.light.css'; 
import DxSparkline from 'devextreme-vue/sparkline'; 

export default { 
    components: { 
        DxSparkline
    }, 
    // ...
    methods: { 
        handlePropertyChange: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    } 
} 
</script> 
React
App.js
import React from 'react';  
import 'devextreme/dist/css/dx.light.css'; 

import Sparkline from 'devextreme-react/sparkline'; 

const handlePropertyChange = (e) => {
    if(e.name === "changedProperty") {
        // handle the property change here
    }
}

export default function App() { 
    return ( 
        <Sparkline ...
            onOptionChanged={handlePropertyChange}
        />        
    ); 
} 

onTooltipHidden

A function that is executed when a tooltip becomes hidden.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

Default Value: null
Cannot be used in themes.

onTooltipShown

A function that is executed when a tooltip appears.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

Sparkline

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

Default Value: null
Cannot be used in themes.

pathModified

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

Type:

Boolean

Default Value: false
Cannot be used in themes.

If you place the UI component on a page that uses a tag modifying the path (<base>, <iframe>, etc.), some of the UI component elements may get mixed up or disappear. To solve this problem, set the pathModified property to true.

See Also

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 property supports the following colors:

pointSize

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

Type:

Number

Default Value: 4

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' | 'cross' | 'polygon' | 'square' | 'triangle' | 'triangleDown' | 'triangleUp'

rtlEnabled

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

Type:

Boolean

Default Value: false
Cannot be used in themes.

When this property is set to true, the UI component 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.

JavaScript
DevExpress.config({
    rtlEnabled: true
});
NOTE
In a right-to-left representation, SVG elements have the direction attribute with the rtl value. This might cause problems when rendering left-to-right texts. Use this property if you have only right-to-left texts.

showFirstLast

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

Type:

Boolean

Default Value: true

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

showMinMax

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

Type:

Boolean

Default Value: false

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

size

Specifies the UI component's size in pixels.

Type:

Object

Default Value: {height: 30, width: 250}

You can specify a custom width and height for the component:

Fixed Relative
Assign values to the size object's height and width properties or specify a container for the component. Specify a container for the component. The component occupies the container area on initialization. If a container's size changes, the component's size does not change. If you want to update the size, call the render method.
NOTE
  • The size object has priority over the container.

  • The size configuration object reserves space for the main UI component elements, while displaying a tooltip may require extra space. To reserve the area around the UI component for the tooltip, you can apply a margin to the UI component's container.

jQuery
index.js
$(function() {
    $("#sparklineContainer").dxSparkline({
        // ...
        size: {
            height: 300,
            width: 600
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-sparkline ... >
    <dxo-size
        [height]="300"
        [width]="600">
    </dxo-size>
</dx-sparkline>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxSparklineModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxSparklineModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxSparkline ... >
        <DxSize
            :height="300"
            :width="600"
        />
    </DxSparkline>
</template>

<script>

import DxSparkline, {
    DxSize
} from 'devextreme-vue/sparkline';

export default {
    components: {
        DxSparkline,
        DxSize
    },
    // ...
}
</script>
React
App.js
import React from 'react';

import Sparkline, {
    Size
} from 'devextreme-react/sparkline';

class App extends React.Component {
    render() {
        return (
            <Sparkline ... >
                <Size
                    height={300}
                    width={600}
                />
            </Sparkline>
        );
    }
}
export default App;

Alternatively, you can use CSS to style the UI component's container:

jQuery
index.js
styles.css
$(function() {
    $("#sparkline").dxSparkline({
        // ...
    });
});
#sparkline {
    width: 85%;
    height: 70%;
}
Angular
app.component.html
app.styles.css
<dx-sparkline ...
    id="sparkline">
</dx-sparkline>
#sparkline {
    width: 85%;
    height: 70%;
}
Vue
App.vue
<template>
    <DxSparkline ...
        id="sparkline">
    </DxSparkline>
</template>

<script>
import DxSparkline from 'devextreme-vue/sparkline';

export default {
    components: {
        DxSparkline
    },
    // ...
}
</script>

<style>
#sparkline {
    width: 85%;
    height: 70%;
}
</style>
React
App.js
styles.css
import React from 'react';

import Sparkline from 'devextreme-react/sparkline';

class App extends React.Component {
    render() {
        return (
            <Sparkline ...
                id="sparkline">
            </Sparkline>
        );
    }
}
export default App;
#sparkline {
    width: 85%;
    height: 70%;
}

theme

Sets the name of the theme the UI component uses.

Type:

String

Default Value: 'generic.light'
Accepted Values: 'generic.dark' | 'generic.light' | 'generic.contrast' | 'generic.carmine' | 'generic.darkmoon' | 'generic.darkviolet' | 'generic.greenmist' | 'generic.softblue' | 'material.blue.light' | 'material.lime.light' | 'material.orange.light' | 'material.purple.light' | 'material.teal.light'

A theme is a UI component configuration that gives the UI component a distinctive appearance. You can use one of the predefined themes or create a custom one. Changing the property values in the UI component's configuration object overrides the theme's corresponding values.

tooltip

Configures the tooltip.

Type:

Object

A tooltip is a miniature rectangle displaying UI component data. The tooltip appears when the end-user hovers the cursor over the UI component. You can enable/disable the tooltip, change its appearance and format its text using fields of the tooltip configuration object.

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

type

Determines the type of a sparkline.

Type:

String

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

The sparkline type determines how data is visualized. The following list shows properties that are available for different types of Sparklines:

View Demo

valueField

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

Type:

String

Default Value: 'val'

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 property supports the following colors:

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

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 properties respectively.