JavaScript/jQuery Chart - Getting Started
The DevExtreme Chart is an interactive UI component that visualizes data using multiple series types: lines, bars, bubbles, candlesticks, and more.
This tutorial explains how to add a Chart to a page and configure component core settings.
Each section in this tutorial covers a single configuration step. You can find the complete source code in the following GitHub repository:
Display Chart Data
To bind a DevExtreme Chart to data, specify the dataSource property. Ensure that the data source contains items with at least two fields: an argument and a value. The Chart looks for fields named arg and val. If field names are different, assign these names to series.argumentField and series.valueField properties:
Add and Customize Tooltips
To add tooltips to a Chart, assign true to the tooltip.enabled property. Default tooltips display values when users hover over points. To implement custom tooltips, define the customizeTooltip function. This example uses customizeTooltip to display the difference between current and average actualSpend values (calculated in the calculateAverageSpend() method):
Specify a Custom Gradient Background
You can customize the appearance of Chart elements. To configure a background gradient, set commonPaneSettings.backgroundColor to a ChartsColor object. In this object, assign the registerGradient return value to fillId:
Add a Constant Line
DevExtreme Chart can display horizontal or vertical constant lines as points of reference. The following example uses the valueAxis.constantLines property to display a horizontal constant line that indicates the yearly spending average (averageSpend):