The documentation for the ExtReact product diverges somewhat from the
documentation of other Sencha products. The sections below describe
documentation for all products except where indicated as unique to
ExtReact
.
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.
ExtReact component classes list the configurable name prominently at the top of the API class doc followed by the fully-qualified class name.
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.
Public classes and class members are available for use by any other class or application code and may be relied upon as a stable and persistent within major product versions. Public classes and members may safely be extended via a subclass.
Protected class members are stable public
members intended to be used by the
owning class or its subclasses. Protected members may safely be extended via a subclass.
Private classes and class members are used internally by the framework and are not intended to be used by application developers. Private classes and members may change or be omitted from the framework at any time without notice and should not be relied upon in application logic.
ExtReact component classes display
configuration options as props
ExtReact component classes do not list
properties as a dedicated member type, but rather as
read only
props
static
label next to the
method name. *See Static below.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).
Let's look at each part of the member row:
lookupComponent
in this example)( item )
in this example)Ext.Component
in this case). This may be omitted for methods that do not
return anything other than undefined
or may display as multiple possible values
separated by a forward slash /
signifying that what is returned may depend on the
results of the method call (i.e. a method may return a Component if a get method calls is
successful or false
if unsuccessful which would be displayed as
Ext.Component/Boolean
).PROTECTED
in
this example - see the Flags section below)Ext.container.Container
in this example). The source
class will be displayed as a blue link if the member originates from the current class
and gray if it is inherited from an ancestor or mixed-in class.view source
in the example)item : Object
in the example).undefined
a "Returns" section
will note the type of class or object returned and a description (Ext.Component
in the
example)Available since 3.4.0
- not pictured in
the example) just after the member descriptionDefaults to: false
)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.
All ExtReact props are bindable
unless decorated as immutable
Immutable ExtReact props may not be use as a configurable prop when instantiating a component
classInstance.method1().method2().etc();
false
is returned from
an event handler- 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
- Indicates a class member of type config
Or in the case of an ExtReact component class this
indicates a member of type prop
- 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
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.
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.
ExtReact component classes do not hoist the getter /
setter methods into the prop. All methods will be described in the
Methods
section
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.
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, inheritance, and read only. 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.
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:
Ext.button.Button
class has an alternate class name of Ext.Button
). Alternate class
names are commonly maintained for backward compatibility.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.
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:
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.
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.
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 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 can be specified as 'polar' or 'spacefilling'.
A Chart component manages the following items:
We provide Ext.chart.axis.Axis to represent all kinds of axes. The axis object works differently according to the its docking position.
Axes help series to map data values into coordinates. They are bound to the type of data that needs to be represented.
The behavior of an axis can be easily changed by setting different types of axis layout and axis segmenter to the axis.
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.
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.
import React, { Component } from 'react';
import { Cartesian } from '@sencha/ext-charts';
import { ExtReact } from '@sencha/ext-react';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1', 'data2', 'data3'],
data: [
{ 'name': 'metric one', 'data1': 10, 'data2': 12, 'data3': 14 },
{ 'name': 'metric two', 'data1': 7, 'data2': 8, 'data3': 16 },
{ 'name': 'metric three', 'data1': 5, 'data2': 2, 'data3': 14 },
{ 'name': 'metric four', 'data1': 2, 'data2': 14, 'data3': 6 },
{ 'name': 'metric five', 'data1': 27, 'data2': 38, 'data3': 36 }
]
})
render() {
return (
<ExtReact>
<Cartesian
store={this.store}
series={[{
type: 'area',
xField: 'name',
yField: ['data1', 'data2', 'data3']
}]}
axes={[{
type: 'category',
position: 'bottom',
fields: ['name'],
title: {
text: 'Sample Values',
fontSize: 15
}
}]}
/>
</ExtReact>
)
}
}
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.
import React, { Component } from 'react';
import { ExtReact } from '@sencha/ext-react';
import { Cartesian } from '@sencha/ext-charts';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1', 'data2', 'data3'],
data: [
{ 'name': 'metric one', 'data1': 10 },
{ 'name': 'metric two', 'data1': 7 },
{ 'name': 'metric three', 'data1': 5 },
{ 'name': 'metric four', 'data1': 2 },
{ 'name': 'metric five', 'data1': 2 }
]
})
render() {
return (
<ExtReact>
<Cartesian
store={this.store}
series={[{
type: 'bar',
xField: 'name',
yField: 'data1'
}]}
axes={[{
type: 'category',
position: 'bottom',
fields: ['name'],
title: {
text: 'Sample Values',
fontSize: 15
}
},{
type: 'numeric',
position: 'left',
fields: 'data1'
}]}
/>
</ExtReact>
)
}
}
The Line series creates a line Chart, an alternative to a bar Chart, for showing categorized numeric data that shows progression or regression.
import React, { Component } from 'react';
import { ExtReact } from '@sencha/ext-react';
import { Cartesian } from '@sencha/ext-charts';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1', 'data2', 'data3'],
data: [
{ name: 'metric one', data1: 14, data2: 19 },
{ name: 'metric two', data1: 16, data2: 7 },
{ name: 'metric three', data1: 11, data2: 25 },
{ name: 'metric four', data1: 6, data2: 4 },
{ name: 'metric five', data1: 36, data2: 12 }
]
})
render() {
return (
<ExtReact>
<Cartesian
store={this.store}
interactions={['rotate']}
axes={[{
type: 'numeric',
position: 'left',
fields: ['data1'],
title: {
text: 'Sample Values',
fontSize: 15
},
grid: true,
minimum: 0
}, {
type: 'category',
position: 'bottom',
fields: ['name'],
title: {
text: 'Sample Values',
fontSize: 15
}
}]}
series={[{
type: 'line',
style: {
stroke: '#30BDA7',
lineWidth: 2
},
xField: 'name',
yField: 'data1',
marker: {
type: 'path',
path: ['M', - 4, 0, 0, 4, 4, 0, 0, - 4, 'Z'],
stroke: '#30BDA7',
lineWidth: 2,
fill: 'white'
}
}, {
type: 'line',
fill: true,
style: {
fill: '#96D4C6',
fillOpacity: .6,
stroke: '#0A3F50',
strokeOpacity: .6,
},
xField: 'name',
yField: 'data2',
marker: {
type: 'circle',
radius: 4,
lineWidth: 2,
fill: 'white'
}
}]}
/>
</ExtReact>
)
}
}
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.
import React, { Component } from 'react';
import { ExtReact } from '@sencha/ext-react';
import { Polar } from '@sencha/ext-charts';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1'],
data: [
{ name: 'metric one', data1: 14 },
{ name: 'metric two', data1: 16 },
{ name: 'metric three', data1: 14 },
{ name: 'metric four', data1: 6 },
{ name: 'metric five', data1: 36 }
]
})
render() {
return (
<ExtReact>
<Polar
store={this.store}
theme="green"
interactions={['rotate']}
series={[{
type: 'pie',
angleField: 'data1',
donut: 30,
label: {
field: 'name',
display: 'rotate'
},
}]}
/>
</ExtReact>
)
}
}
The Radar series creates a radar Chart, a great way to display a comparison of different quantitative values for a constrained number of categories.
import React, { Component } from 'react';
import { ExtReact } from '@sencha/ext-react';
import { Polar } from '@sencha/ext-charts';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1'],
data: [
{ name: 'metric one', data1: 14 },
{ name: 'metric two', data1: 16 },
{ name: 'metric three', data1: 14 },
{ name: 'metric four', data1: 6 },
{ name: 'metric five', data1: 36 }
]
})
render() {
return (
<ExtReact>
<Polar
store={this.store}
theme="green"
interactions={['rotate']}
series={[{
type: 'radar',
angleField: 'name',
radiusField: 'data1',
style: {
fillStyle: '#388FAD',
fillOpacity: .1,
strokeStyle: '#388FAD',
strokeOpacity: .8,
lineWidth: 1
}
}]}
axes={[{
type: 'numeric',
position: 'radial',
fields: 'data1',
style: {
estStepSize: 10
},
grid: true
}, {
type: 'category',
position: 'angular',
fields: 'name',
style: {
estStepSize: 1
},
grid: true
}]}
/>
</ExtReact>
)
}
}
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.
import React, { Component } from 'react';
import { ExtReact } from '@sencha/ext-react';
import { Cartesian } from '@sencha/ext-charts';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1', 'data2', 'data3'],
data: [
{ name: 'metric one', data1: 14, data2: 19 },
{ name: 'metric two', data1: 16, data2: 7 },
{ name: 'metric three', data1: 11, data2: 25 },
{ name: 'metric four', data1: 6, data2: 4 },
{ name: 'metric five', data1: 36, data2: 12 }
]
})
render() {
return (
<ExtReact>
<Cartesian
store={this.store}
interactions={['rotate']}
axes={[{
type: 'numeric',
position: 'left',
fields: ['data1'],
title: {
text: 'Sample Values',
fontSize: 15
},
grid: true,
minimum: 0
}, {
type: 'category',
position: 'bottom',
fields: ['name'],
title: {
text: 'Sample Values',
fontSize: 15
}
}]}
series={[{
type: 'scatter',
highlight: {
size: 12,
radius: 12,
fill: '#96D4C6',
stroke: '#30BDA7'
},
fill: true,
xField: 'name',
yField: 'data2',
marker: {
type: 'circle',
fill: '#30BDA7',
radius: 10,
lineWidth: 0
}
}]}
/>
</ExtReact>
)
}
}
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.
import React, { Component } from 'react';
import { ExtReact } from '@sencha/ext-react';
import { Polar } from '@sencha/ext-charts';
export default class MyExample extends Component {
store = Ext.create('Ext.data.Store', {
fields: ['name', 'data1', 'data2', 'data3'],
data: [{
mph: 65,
fuel: 50,
temp: 150,
rpm: 6000
}]
})
render() {
return (
<ExtReact>
<Polar
store={this.store}
series={[{
type: 'gauge',
angleField: 'mph',
needle: true,
donut: 30
}]}
/>
</ExtReact>
)
}
}
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.
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.
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.
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.
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.