Chart

A widget used to embed charts into HTML JS applications.

Included in: dx.chartjs.js, dx.all.js

The dxChart widget is used to display different types of data graphically. It visualizes a series of points using one of the available series types. This widget can draw a single series, as well as several series of different types on one or more panes.

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

  • jQuery
    Use the dxChart jQuery plug-in.

    HTML
    <div id="chartContainer"></div>
    JavaScript
    $("#chartContainer").dxChart({
        dataSource: dataSource,
        commonSeriesSettings: {
            argumentField: "state",
            type: "bar"
        },
        series: [
            { valueField: "year2004", name: "2004" },
            { valueField: "year2001", name: "2001" },
            { valueField: "year1998", name: "1998" }
        ]
    });
  • Knockout
    Add a div element and apply the dxChart binding to this element.

    HTML
    <div data-bind="dxChart: {
        dataSource: dataSource,
        commonSeriesSettings: {
            argumentField: "state",
            type: "bar"
        },
        series: [
            { valueField: "year2004", name: "2004" },
            { valueField: "year2001", name: "2001" },
            { valueField: "year1998", name: "1998" }
        ]
    }"></div>
  • Angular
    Add a div element and apply the dx-chart directive to this element.

    HTML
    <div dx-chart="{
        dataSource: dataSource,
        commonSeriesSettings: {
            argumentField: "state",
            type: "bar"
        },
        series: [
            { valueField: "year2004", name: "2004" },
            { valueField: "year2001", name: "2001" },
            { valueField: "year1998", name: "1998" }
        ]
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required. For detailed information on creating widgets, refer to the Create a Widget article.

To learn how to provide data for the dxChart widget, refer to the Data Binding article.

The dxChart widget contains multiple visual elements (axes, titles, labels, strips, grid, etc.) that are configured within the widget's configuration object. To learn more about the widget's visual elements, refer to the Chart Elements help article.

Start Tutorial View Demo Watch Video

See Also

To learn the widget's concepts and overview features, refer to the Charts section within the Data Visualization Guides.

Configuration

An object defining configuration options for the dxChart widget.

Methods

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

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

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

Events

This section describes events exposed by this widget.

To handle events, use one of the following methods.

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.