Docs Help

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level and inheritance. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

Ext JS 5.1.0

Guides
API
top

Introduction to Charting

The Chart package consists of a hierarchy of classes that provide data visualization functionality. These include series, axes, interactions, and mechanisms for implementing markers and legends. This guide provides an overview on how these classes are tied together and what functionality is included in each class. The following sections cover the specific axes, series, and interactions.

Installing Sencha Charts

Sencha Charts are not included in the Ext JS library by default. In order to include the charts package, simply add "charts" ("sencha-charts" if working with Ext JS 5.x) to the requires block in your Sencha Cmd generated application's {appRoot}/app.json file. Adding a package name to the requires array directs Cmd to make the package available to your application.

After making the inclusion, ensure that your application has been rebuilt. Applications may be rebuilt by manually issuing the following command:

sencha app build

You may also activate "app watch":

sencha app watch

Sencha app watch monitors your application's assets and rebuilds when it detects change.

Note: For more information on generating and building apps with Sencha Cmd see the Intro to Cmd guide.

Using Sencha Charts without Sencha Cmd

If you want to use charts, but do not want to use Sencha Cmd, you may simply add the following inclusions to your app's index.html page.

// in Ext JS 5.x

<script type="text/javascript" src="{SDKLocation}/build/packages/sencha-charts/build/sencha-charts.js"></script>
<link rel="stylesheet" type="text/css" href="{SDKLocation}/build/packages/sencha-charts/build/{themeName}/resources/sencha-charts-all.css">


// in Ext JS 6.x

<script type="text/javascript" src="{SDKLocation}/build/packages/charts/{toolkitName}/charts.js"></script>
<link rel="stylesheet" type="text/css"  href="{SDKLocation}/build/packages/charts/{toolkitName}/{themeName}/resources/charts-all.css">

The Chart Component Class

All types of Chart components are extended from the AbstractChart class, which extends Ext.draw.Container. A Chart component is the container for managing series and axes. It is responsible for laying out the series and axes every time the size is changed. An implementation of the abstract class must override the performLayout method. For example, a Chart needs to respond to the changes of the thickness of the axes and recalculate the series area.

There are three types of charts:

  • cartesian/chart - Creates a Chart for series implementations that plot values using cartesian coordinates. Examples of this include Bar, Area, Scatter, and Line charts.
  • polar - Creates a chart for series implementations that plot values using polar coordinates. Examples of this include Pie and Radial charts.
  • spacefilling - Creates a chart that fills the entire area of the chart.

The "ext-charts" package (the legacy charts package from 4.x - available in 5.x and retired with 6.x) tried to automatically determine the Chart type by evaluating the series type. This allowed users to simply set the xtype to 'chart'. However, "sencha-charts" ("charts" being the package name in 6.x) needs a designated xtype in some circumstances. Cartesian Charts are the most commonly used and are mapped to the xtype of 'chart'. Setting an xtype of 'chart' makes the assumption that you want a Bar, Line, Scatter, or Area Chart. Other types of Charts will require an xtype designation of 'polar' or 'spacefilling'.

Chart Component Management

A Chart component manages the following items:

  • Axes - These are accessed through Ext.chart.axis.Axis and represent all the axes being defined and drawn for this visualization. This is a mixed collection.
  • Series - These are accessed through Ext.chart.series.Series and represent all the series being drawn for the chart. This could be line, bar, scatter, and so on. This is also a mixed collection.
  • Interactions - These are controllers that directly manipulate the series and axes when certain events are recognized.
  • Legend Store - This represents the legend information collected from the series. Normally you can attach a data list to this store and get automatically updated on the legend information changes.

Axes

We provide Ext.chart.axis.Axis to represent all kinds of axes. The axis object works differently according to the its docking position.

  • left/right - The axis is vertical.
  • top/bottom - The axis is horizontal.

Axes help series to map data values into coordinates. They are bound to the type of data that needs to be represented.

  • numeric - the data attached to this axis is numeric and continuous.
  • time - the data attached to this axis is (or gets converted into) a date/time value; it is continuous.
  • category - the data attached to this axis belongs to a finite set. The data points are evenly placed along the axis.

The behavior of an axis can be easily changed by setting different types of axis layout and axis segmenter to the axis.

Series

Series is an abstract class extended by concrete visualizations, such as Line Series, Bar Series, or Scatter Series.

The Series class itself contains code that is common to all of these series, such as event handling, highlighting, markers, labels, and so on.

The following sections describe available series types. It also shows a complete series configuration example, including the Chart, Axis, and Series options. For more specific information, see the Series documentation.

Area

The Area series creates a stacked area Chart, which is typically used to display multiple aggregated layers of information. Similar to other series, the Area series must be added into the series config of the Chart.

You can specify multiple y fields on a stacked series such as Area series and Bar series. A typical configuration object for the Area series looks as in the following code sample:

Ext.create('Ext.chart.CartesianChart', {
    renderTo: document.body,
    width: 500,
    height: 300,
    store: {
        fields: ['name', 'g1', 'g2'],
        data: [
            {"name": "Item-0", "g1": 18.34,"g2": 0.04},
            {"name": "Item-1", "g1": 2.67, "g2": 14.87},
            {"name": "Item-2", "g1": 1.90, "g2": 5.72},
            {"name": "Item-3", "g1": 21.37,"g2": 2.13},
            {"name": "Item-4", "g1": 2.67, "g2": 8.53},
            {"name": "Item-5", "g1": 18.22,"g2": 4.62},
            {"name": "Item-6", "g1": 28.51, "g2": 12.43},
            {"name": "Item-7", "g1": 34.43, "g2": 4.40},
            {"name": "Item-8", "g1": 21.65, "g2": 13.87},
            {"name": "Item-9", "g1": 12.98, "g2": 35.44},
            {"name": "Item-10", "g1": 22.96, "g2": 38.70},
            {"name": "Item-11", "g1": 0.49, "g2": 51.90},
            {"name": "Item-12", "g1": 20.87, "g2": 62.07},
            {"name": "Item-13", "g1": 25.10, "g2": 78.46},
            {"name": "Item-14", "g1": 16.87, "g2": 56.80}
        ]
    },

    interactions: {
        type: 'panzoom'
    },

    legend: {
        docked: 'right'
    },

    axes: [{
        type: 'numeric',
        position: 'left',
        grid: true
    }, {
        type: 'category',
        position: 'bottom',
        visibleRange: [0, 0.4]
    }],

    series: [{
        type: 'area',
        xField: 'name',
        yField: ['g1', 'g2'],
        title: ['G1', 'G2'],
        style: {
            stroke: '#666666',
            fillOpacity: 0.8
        }
    }]
});

Bar

The Bar series creates a stackable or group-able bar Chart, which is typically used to display categorized numeric data that shows progression or regression. Note that opposed to the old chart package, a Bar series refers to a vertical bar series, or a column series. You can obtain the horizontal configuration by setting flipXY to true the Chart.

A Bar series can either be stacked or grouped. You can set the stacked config on the series to false in order to switch the series to the grouped mode.

A sample Bar chart is shown in the following example:

Ext.create('Ext.chart.CartesianChart', {
    renderTo: document.body,
    width: 500,
    height: 500,
    flipXY: true,
    store: {
        fields: ['name', 'g1', 'g2'],
        data: [
            {"name": "Item-0", "g1": 18.34,"g2": 0.04},
            {"name": "Item-1", "g1": 2.67, "g2": 14.87},
            {"name": "Item-2", "g1": 1.90, "g2": 5.72},
            {"name": "Item-3", "g1": 21.37,"g2": 2.13},
            {"name": "Item-4", "g1": 2.67, "g2": 8.53},
            {"name": "Item-5", "g1": 18.22,"g2": 4.62},
            {"name": "Item-6", "g1": 28.51, "g2": 12.43},
            {"name": "Item-7", "g1": 34.43, "g2": 4.40},
            {"name": "Item-8", "g1": 21.65, "g2": 13.87},
            {"name": "Item-9", "g1": 12.98, "g2": 35.44},
            {"name": "Item-10", "g1": 22.96, "g2": 38.70},
            {"name": "Item-11", "g1": 0.49, "g2": 51.90},
            {"name": "Item-12", "g1": 20.87, "g2": 62.07},
            {"name": "Item-13", "g1": 25.10, "g2": 78.46},
            {"name": "Item-14", "g1": 16.87, "g2": 56.80}
        ]
    },  

    //set legend configuration
    legend: {
        docked: 'right'
    },

    //define the x and y-axis configuration.
    axes: [{
        type: 'numeric',
        position: 'bottom',
        grid: true,
        minimum: 0
    }, {
        type: 'category',
        position: 'left'
    }],

    //define the actual bar series.
    series: [{
        type: 'bar',
        xField: 'name',
        yField: ['g1', 'g2'],
        axis: 'bottom',
        // Cycles the green and blue fill mode over 2008 and 2009
        // subStyle parameters also override style parameters
        subStyle: {
            fill: ["#115fa6", "#94ae0a"]
        }
    }]
});

Line

The Line series creates a line Chart, an alternative to a bar Chart, for showing categorized numeric data that shows progression or regression. The following example shows a typical configuration object for the Line series:

Ext.create('Ext.chart.CartesianChart', {
    renderTo: document.body,
    width: 500,
    height: 500,
    store: {
        fields: ['name', 'g1', 'g2'],
        data: [
            {"name": "Item-0", "g1": 18.34,"g2": 0.04},
            {"name": "Item-1", "g1": 2.67, "g2": 14.87},
            {"name": "Item-2", "g1": 1.90, "g2": 5.72},
            {"name": "Item-3", "g1": 21.37,"g2": 2.13},
            {"name": "Item-4", "g1": 2.67, "g2": 8.53},
            {"name": "Item-5", "g1": 18.22,"g2": 4.62},
            {"name": "Item-6", "g1": 28.51, "g2": 12.43},
            {"name": "Item-7", "g1": 34.43, "g2": 4.40},
            {"name": "Item-8", "g1": 21.65, "g2": 13.87},
            {"name": "Item-9", "g1": 12.98, "g2": 35.44},
            {"name": "Item-10", "g1": 22.96, "g2": 38.70},
            {"name": "Item-11", "g1": 0.49, "g2": 51.90},
            {"name": "Item-12", "g1": 20.87, "g2": 62.07},
            {"name": "Item-13", "g1": 25.10, "g2": 78.46},
            {"name": "Item-14", "g1": 16.87, "g2": 56.80}
        ]
    },
    interactions: ['panzoom'],

    legend: {
        docked: 'bottom'
    },

    //define x and y axis.
    axes: [{
        type: 'numeric',
        position: 'left'
    }, {
        type: 'category',
        visibleRange: [0, 1],
        position: 'bottom'
    }],

    //define the actual series
    series: [{
        type: 'line',
        xField: 'name',
        yField: 'g1',
        title: 'Normal',
        style: {
            fill: "#115fa6",
            stroke: "#115fa6",
            fillOpacity: 0.6,
            miterLimit: 3,
            lineCap: 'miter',
            lineWidth: 2
        }
    }, {
        type: 'line',
        xField: 'name',
        yField: 'g2',
        title: 'Smooth',
        style: {
            smooth: true,
            stroke: "#94ae0a",
            fillOpacity: 0.6,
            miterLimit: 3,
            lineCap: 'miter',
            lineWidth: 2
        }
    }]
});

Pie

The Pie series creates a pie Chart, a great way to display quantitative information for a number of categories that also have a meaning as a whole, for example, all 12 months of a given year.

A Pie chart example is given in the following code sample:

Ext.create('Ext.chart.PolarChart', {
    renderTo: document.body,
    width: 500,
    height: 500,
    store: {
        fields: ['name', 'g1', 'g2'],
        data: [
            {"name": "Item-0", "g1": 18.34,"g2": 0.04},
            {"name": "Item-1", "g1": 2.67, "g2": 14.87},
            {"name": "Item-2", "g1": 1.90, "g2": 5.72},
            {"name": "Item-3", "g1": 21.37,"g2": 2.13},
            {"name": "Item-4", "g1": 2.67, "g2": 8.53},
            {"name": "Item-5", "g1": 18.22,"g2": 4.62}
        ]
    },

    interactions: ['rotate'],

    //configure the legend.
    legend: {
        docked: 'bottom'
    },

    //describe the actual pie series.
    series: [{
        type: 'pie',
        xField: 'g1',
        label: {
            field: 'name',
            display: 'rotate'
        },
        donut: 25,
        style: {
            miterLimit: 10,
            lineCap: 'miter',
            lineWidth: 2
        }
    }]
}); 

Radar

The Radar series creates a radar Chart, a great way to display a comparison of different quantitative values for a constrained number of categories. A Radar series example is illustrated by the following code:

Ext.create('Ext.chart.PolarChart', {
    renderTo: document.body,
    width: 500,
    height: 500,
    store: {
        fields: ['name', 'g1', 'g2'],
        data: [
            {"name": "0", "g1": 18.34},
            {"name": "1", "g1": 2.67},
            {"name": "2", "g1": 1.90},
            {"name": "3", "g1": 21.37},
            {"name": "4", "g1": 2.67},
            {"name": "5", "g1": 18.22},
            {"name": "6", "g1": 28.51},
            {"name": "7", "g1": 34.43},
            {"name": "8", "g1": 21.65},
            {"name": "9", "g1": 12.98},
            {"name": "10", "g1": 22.96},
            {"name": "11", "g1": 0.49},
            {"name": "12", "g1": 20.87},
            {"name": "13", "g1": 25.10},
            {"name": "14", "g1": 16.87}
        ]
    },

    // Set rotation
    interactions: ['rotate'],

    // Define radial and angular axis for the radar chart.
    axes: [{
        type: 'numeric',
        position: 'radial',
        fields: 'g1',
        grid: true,
        label: {
            fill: 'black',
            y: -8
        }
    }, {
        type: 'category',
        position: 'angular',
        fields: 'name',
        grid: true,
        label: {
            fill: 'black'
        }
    }],

    series: [{
        type: 'radar',
        xField: 'name',
        yField: 'g1'
    }]
});

Scatter

The Scatter series creates a scatter Chart, which enables an application to display more than two variables in the same visualization. These variables can be mapped onto x, y coordinates and also to an element's properties, such as radius, size, color, and so on.

Ext.create('Ext.chart.CartesianChart', {
    renderTo: document.body,
    width: 500,
    height: 500,
    store: {
        fields: ['name', 'g1', 'g2'],
        data: [
            {"name": "Item-0", "g1": 18.34,"g2": 0.04},
            {"name": "Item-1", "g1": 2.67, "g2": 14.87},
            {"name": "Item-2", "g1": 1.90, "g2": 5.72},
            {"name": "Item-3", "g1": 21.37,"g2": 2.13},
            {"name": "Item-4", "g1": 2.67, "g2": 8.53},
            {"name": "Item-5", "g1": 18.22,"g2": 4.62},
            {"name": "Item-6", "g1": 28.51, "g2": 12.43},
            {"name": "Item-7", "g1": 34.43, "g2": 4.40},
            {"name": "Item-8", "g1": 21.65, "g2": 13.87},
            {"name": "Item-9", "g1": 12.98, "g2": 35.44},
            {"name": "Item-10", "g1": 22.96, "g2": 38.70},
            {"name": "Item-11", "g1": 0.49, "g2": 51.90},
            {"name": "Item-12", "g1": 20.87, "g2": 62.07},
            {"name": "Item-13", "g1": 25.10, "g2": 78.46},
            {"name": "Item-14", "g1": 16.87, "g2": 56.80}
        ]
    },

    axes: [{
        type: 'numeric',
        position: 'bottom'
    }, {
        type: 'numeric',
        position: 'left'
    }],
    series: [{
        type: 'scatter',
        xField: 'g1',
        yField: 'g2',
        marker: {
            radius: 4
        },
        highlight: {
            fillStyle: 'yellow',
            radius: 7,
            lineWidth: 2
        },
    }]
});

Gauge

The Gauge series creates a gauge Chart, typically used to show progress in a certain variable. In addition to using stores, you can also set a value of the gauge series to show the value.

An example is given in the following code sample:

Ext.create('Ext.chart.PolarChart', {
    renderTo: document.body,
    width: 500,
    height: 500,
    series: [{
        type: 'gauge',
        minimum: 100,
        maximum: 800,
        value: 400,
        donut: 30,
        colors: ["#115fa6", "lightgrey"]
    }]
});           

Interactions

This section introduces the interaction features in the Sencha Charts package. By taking advantage of these features, you can create highly interactive Charts that enable users to visualize and navigate complex data sets.

Adding Interactions

To add interactions to a Chart, set the interactions config of the Chart to an array of interaction config objects. Each object must be a string or must contain a type property matching one of the interaction types described in the subsequent sections. Each object may also contain additional config options that are appropriate for a particular interaction.

You can define your own interaction by extending the Ext.chart.interactions.Abstract class and registering the name using an alias with the "interaction" prefix. For example, if you want to create an interaction called "remove", create an alias of the class named "interaction.remove", then set the type: 'remove' in the interaction config.

Here are a couple of examples of basic interactions.

Item Highlighting

The "itemhighlight" interaction enables you to highlight individual data point items on the chart.

This interaction is implemented by the Ext.chart.interactions.ItemHighlight class. See the class documentation for detailed configuration options.

Rotate

The "rotate" interaction enables users to rotate a pie or a radar Chart, by default the rotation being performed using a drag gesture. The following code snippet is an example of how simple it is to add the rotate interaction to your pie or radar Charts:

interactions: ['rotate']

This interaction is implemented by the Ext.chart.interactions.Rotate class. See the class documentation for detailed configuration options.

Legend Store

The Chart exposes a store to represent legend information collected from series. Technically, you can do anything with this store. Again, this architecture can help you decouple the legend information from the legend component, so you can use any technology and customization for showing the legend at any desired place.

For you convenience, we also provide a default Legend component that already implements some common and basic functionality for displaying legends. The Chart configuration object accepts a legend section to enable the default Legend component and dock it in the Chart. The default Legend component contains a dock config and it is docked on that side.

Ext JS 5.1.0

Ext JS
Sencha Test
Cmd
Sencha Themer
GXT
IDE Plugins
Sencha Inspector
Architect
Sencha Fiddle
Touch
Offline Documentation

Sencha Test

2.0.0 EA 1.0.3

Cmd

Cmd

Sencha Themer

1.1.0 EA 1.0.2

GXT

5.x EA 4.x 3.x

IDE Plugins

IDE Plugins

Sencha Inspector

Sencha Inspector

Sencha Fiddle

Sencha Fiddle

Offline Documentation

Offline Documentation