Sencha Documentation

The Ext.chart package provides the capability to visualize data. Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart. A chart configuration object has some overall styling options as well as an array of axes and series. A chart instance example could look like:
var chart = new Ext.chart.Chart({
        renderTo: Ext.getBody(),
        width: 800,
        height: 600,
        animate: true,
        store: store1,
        renderTo: Ext.getBody(),
        shadow: true,
        theme: 'Category1',
        legend: {
            position: 'right'
        },
        axes: [ ...some axes options... ],
        series: [ ...some series options... ]
    });
In this example we set the `width` and `height` of the chart, we decide whether our series are animated or not and we select a store to be bound to the chart. We also turn on shadows for all series, select a color theme `Category1` for coloring the series, set the legend to the right part of the chart and then tell the chart to render itself in the body element of the document. For more information about the axes and series configurations please check the documentation of each series (Line, Bar, Pie, etc).

Config Options

 
animate : Boolean/Object
true for the default animation (easing: 'ease' and duration: 500) or a standard animation config object to be used fo...
true for the default animation (easing: 'ease' and duration: 500) or a standard animation config object to be used for default chart animations. Defaults to false.
 
autoSize : Boolean
Turn on autoSize support which will set the bounding div's size to the natural size of the contents. Defaults to fals...
Turn on autoSize support which will set the bounding div's size to the natural size of the contents. Defaults to false.
 
background : string
Set the chart background. This can be a gradient name, image, or color. Defaults to false for no background.
Set the chart background. This can be a gradient name, image, or color. Defaults to false for no background.
 
height : Number
The height of this component in pixels (defaults to auto). Note to express this dimension as a percentage or offset s...
The height of this component in pixels (defaults to auto). Note to express this dimension as a percentage or offset see Ext.Component.anchor.
 
implOrder : Array
Defines the priority order for which Surface implementation to use. The first one supported by the current environmen...
Defines the priority order for which Surface implementation to use. The first one supported by the current environment will be used.
 
insetPadding : integer
Set the amount of inset padding in pixels for the chart. Defaults to 10.
Set the amount of inset padding in pixels for the chart. Defaults to 10.
 
legend : Boolean/Object
true for the default legend display or a legend config object. Defaults to false.
true for the default legend display or a legend config object. Defaults to false.
 
resize : boolean
Optional flag which changes the default origin points of the chart for animations.
Optional flag which changes the default origin points of the chart for animations.
 
viewBox : Boolean
Turn on view box support which will scale and position items in the draw component to fit to the component while main...
Turn on view box support which will scale and position items in the draw component to fit to the component while maintaining aspect ratio. Defaults to true.
 
width : Number
The width of this component in pixels (defaults to auto). Note to express this dimension as a percentage or offset se...
The width of this component in pixels (defaults to auto). Note to express this dimension as a percentage or offset see Ext.Component.anchor.

Properties

 
addGradient : Object
Add a gradient definition to the Surface. Note that in some surface engines, adding a gradient via this method will n...
Add a gradient definition to the Surface. Note that in some surface engines, adding a gradient via this method will not take effect if the surface has already been rendered. Therefore, it is preferred to pass the gradients as an item to the surface config, rather than calling this method, especially if the surface is rendered immediately (e.g. due to 'renderTo' in its config).

Methods

 
addCls( String sprite, String/Array className ) : Ext.draw.Sprite
Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.

Parameters

  • sprite : String
    The sprite to add, or an array of classes to
  • className : String/Array
    The CSS class to add, or an array of classes

Returns

  • Ext.draw.Sprite   this
 
addGradient( Object gradient ) : Void
Adds a definition to this Surface for a linear gradient. We convert the gradient definition to its corresponding VML ...
Adds a definition to this Surface for a linear gradient. We convert the gradient definition to its corresponding VML attributes and store it for later use by individual sprites.

Parameters

  • gradient : Object

Returns

  • Void
 
applyZIndex( Ext.draw.Sprite sprite ) : Void
Insert or move a given sprite's element to the correct place in the DOM list for its zIndex
Insert or move a given sprite's element to the correct place in the DOM list for its zIndex

Parameters

  • sprite : Ext.draw.Sprite

Returns

  • Void
 
bindStore( Store store ) : Void
Changes the data store bound to this chart and refreshes it.
Changes the data store bound to this chart and refreshes it.

Parameters

  • store : Store
    The store to bind to this chart

Returns

  • Void
 
Create the Surface instance. Resolves the correct Surface implementation to instantiate based on the 'implOrder' conf...
Create the Surface instance. Resolves the correct Surface implementation to instantiate based on the 'implOrder' config.
 
getId : Void
Retrieves the id of this component. Will autogenerate an id if one has not already been set.
Retrieves the id of this component. Will autogenerate an id if one has not already been set.
 
getRegion : Void
Get the region for the surface's canvas area
Get the region for the surface's canvas area
 
hasCls( String className ) : Boolean
Checks if the specified CSS class exists on this element's DOM node.
Checks if the specified CSS class exists on this element's DOM node.

Parameters

  • className : String
    The CSS class to check for

Returns

  • Boolean   True if the class exists, else false
 
newInstance( Object config, Array implOrder ) : Void
Create and return a new concrete Surface instance appropriate for the current environment.
Create and return a new concrete Surface instance appropriate for the current environment.

Parameters

  • config : Object
    Initial configuration for the Surface instance
  • implOrder : Array
    Optional order of implementations to use; the first one that is available in the current environment will be used. Defaults to ['SVG', 'Canvas', 'VML].

Returns

  • Void
 
onDestroy : Void
Clean up the Surface instance on component destruction
Clean up the Surface instance on component destruction
 
onRender : Void
Create the Surface on initial render
Create the Surface on initial render
 
positionSpriteInList( Ext.draw.Sprite sprite ) : Number
Insert or move a given sprite into the correct position in the items MixedCollection, according to its zIndex. Will b...
Insert or move a given sprite into the correct position in the items MixedCollection, according to its zIndex. Will be inserted at the end of an existing series of sprites with the same or lower zIndex. If the sprite is already positioned within an appropriate zIndex group, it will not be moved. This ordering can be used by subclasses to assist in rendering the sprites in the correct order for proper z-index stacking.

Parameters

  • sprite : Ext.draw.Sprite

Returns

  • Number   the sprite's new index in the list
 
removeCls( String sprite, String/Array className ) : Ext.draw.Sprite
Removes one or more CSS classes from the element.
Removes one or more CSS classes from the element.

Parameters

  • sprite : String
    The sprite to add, or an array of classes to
  • className : String/Array
    The CSS class to remove, or an array of classes

Returns

  • Ext.draw.Sprite   this
 
setStyle( String/Object property, [String value] ) : Ext.draw.Sprite
Wrapper for setting style properties, also takes single object parameter of multiple styles.
Wrapper for setting style properties, also takes single object parameter of multiple styles.

Parameters

  • property : String/Object
    The style property to be set, or an object of multiple styles.
  • value : String
    (optional) The value to apply to the given property, or null if an object was passed.

Returns

  • Ext.draw.Sprite   this

Events

 
beforerefresh( Chart this )
Fires before a refresh to the chart data is called. If the beforerefresh handler returns false the refresh action wi...
Fires before a refresh to the chart data is called. If the beforerefresh handler returns false the refresh action will be cancelled.

Parameters

  • this : Chart

Returns

  • Void
 
refresh( Chart this )
Fires after the chart data has been refreshed.
Fires after the chart data has been refreshed.

Parameters

  • this : Chart

Returns

  • Void