Sparkline

The Sparkline widget 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.

Included in: dx.viz.js, dx.viz-web.js, dx.all.js
Module: viz/sparkline
Sparkline interactive configuration
Copy Code
Copy to Codepen
$("#sparkline").dxSparkline({
});

You can create the widget using one of the following approaches.

  • jQuery
    Use the dxSparkline jQuery plug-in.

    HTML
    <div id="sparklineContainer"></div>
    JavaScript
    $("#sparklineContainer").dxSparkline({
        dataSource: dataSource,
        argumentField: 'month',
        valueField: '2010',
        type: 'spline'
    });
  • Knockout
    Add a div element and apply the dxSparkline binding to this element.

    HTML
    <div data-bind="dxSparkline: {
        dataSource: dataSource,
        argumentField: 'month',
        valueField: '2010',
        type: 'spline'
    }"></div>
  • AngularJS
    Add a div element and apply the dx-sparkline directive to this element.

    HTML
    <div dx-sparkline="{
        dataSource: dataSource,
        argumentField: 'month',
        valueField: '2010',
        type: 'spline'
    }"></div>

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

View Demo Watch Video

Configuration

An object that specifies configuration options for the Sparkline widget.

Methods

This section describes the methods that can be used in code to manipulate objects related to the Sparkline widget.

Events

This section describes events fired by this widget.