Click to search on your search term.
Subscribe to Fig Leaf Tutorials


Need help with a project? Contact us at sales@figleaf.com.
From code reviews to project "jumpstarts" and full life-cycle development, we've got you covered!
Check out our case studies!
Follow us on Twitter!
Click here to join our Facebook group!

Ready to upgrade your skills? Try these instructor-led classes in Washington, DC:
Ext JS 6 Bootcamp
12/04/2017

Defining a Data Store to Support Charting

Page of 168

You will typically need to define a data model and store from which the chart will be generated. For plotting a single data series in a bar chart or pie chart the model typically consists of only two fields - a numeric field ("value") to plot against the Y axis and a string field ("label") to plot against the X axis. Ext JS does support the charting of multiple series. For example, you can overlay multiple lines on a line chart. In these types of use cases you would need to add additional fields to your model in order to capture the additional series data points.

The following snippet illustrates a typical, purpose-built charting data store.

Ext.define('MyApp.store.ChartData', {
 extend: 'Ext.data.Store',
 fields: [
  { name: 'label'},
  { name: 'value', type: 'float'}
 ],
 remoteFilter: true,
 proxy: {
   type: 'ajax',
   url: 'http://www.someurl.com/getdata.php'
 }
});
Page of 168
comments powered by Disqus