Chart

The Chart is a widget that visualizes data from a local or remote storage using a great variety of series types along with different interactive elements, such as tooltips, crosshair pointer, legend, etc.

Included in: dx.viz.js, dx.viz-web.js, dx.all.js
Module: viz/chart
Export: default
Chart interactive configuration
Copy Code
Copy to Codepen
$("#chart").dxChart({
});

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

  • jQuery

    HTML
    JavaScript
    <div id="chart"></div>
    var fruits = [
        { fruit: 'Oranges', yield: 10, consumed: 7 },
        { fruit: 'Apples', yield: 15, consumed: 14 },
        { fruit: 'Bananas', yield: 9, consumed: 9 }
    ];
    $(function() {
        $("#chart").dxChart({
            dataSource: fruits,
            commonSeriesSettings: {
                argumentField: "fruit",
                type: "bar"
            },
            series: [
                { valueField: "yield" },
                { valueField: "consumed" }
            ]
        });
    });
  • Angular

    HTML
    JavaScript
    <dx-chart [dataSource]="fruits">
        <dxo-common-series-settings
            argumentField="fruit"
            type="bar">
        </dxo-common-series-settings>
        <dxi-series valueField="yeld"></dxi-series>
        <dxi-series valueField="consumed"></dxi-series>
    </dx-chart>
    export class AppComponent {
        fruits = [
            // ...   
        ];
    }
  • AngularJS

    HTML
    JavaScript
    <div ng-controller="DemoController">
        <div dx-chart="{
            dataSource: fruits,
            commonSeriesSettings: {
                argumentField: 'fruit',
                type: 'bar'
            },
            series: [
                { valueField: 'yield' },
                { valueField: 'consumed' }
            ]
        }"></div>
    </div>
    angular.module('DemoApp', ['dx'])
        .controller("DemoController", function ($scope) {
            $scope.fruits = [
                // ...   
            ];
        });
  • Knockout

    HTML
    JavaScript
    <div data-bind="dxChart: {
        dataSource: fruits,
        commonSeriesSettings: {
            argumentField: 'fruit',
            type: 'bar'
        },
        series: [
            { valueField: 'yield' },
            { valueField: 'consumed' }
        ]
    }"></div>
    var viewModel = {
        fruits: [
            // ...
        ]
    };
    ko.applyBindings(viewModel);
  • ASP.NET MVC Wrappers

    Razor C#
    Razor VB
    @(Html.DevExtreme().Chart()
        .ID("chart")
        .DataSource(Fruits)
        .CommonSeriesSettings(c => c
            .ArgumentField("fruit")
            .Type(SeriesType.Bar)
        )
        .Series(series => {
            series.Add().ValueField("yield");
            series.Add().ValueField("consumed");
        })
    )
    @(Html.DevExtreme().Chart() _
        .ID("chart") _
        .DataSource(Fruits) _
        .CommonSeriesSettings(Sub(c)
            c.ArgumentField("fruit") _
             .Type(SeriesType.Bar)
        End Sub) _
        .Series(Sub(series)
            series.Add().ValueField("yield")
            series.Add().ValueField("consumed")
        End Sub)
    )

All DevExtreme widgets require linking the jQuery library. Linking the Knockout or AngularJS library is optional. For detailed information on how to link the needed libraries, refer to the topics in the Installation section.

View Demo

See Also

Configuration

This section describes properties that configure the contents, behavior and appearance of the Chart widget.

Methods

This section describes the methods that can be used in code to manipulate the Chart object.

Use the dxChart registered method to access the Chart widget as demonstrated in the code below.

JavaScript
var chart = $("#chartContainer").dxChart("instance");

Events

This section describes events fired by this widget.

Series Types

This section lists objects that define options used to configure series of specific types.

Chart Elements

This section lists the methods and fields of chart elements.