Note that there are some explanatory texts on larger screens.

plurals
  1. POFully update pie chart using ExtJS 4.2.0 and external datasource
    primarykey
    data
    text
    <p>I am currently creating a "drill-down" style pie chart, where clicking on a "slice" should update the pie chart with data within that slice.</p> <p>Imagine for example an E-commerce report which shows sales by top level categories:</p> <p>Shirts - $10,000 Pants - $8,000 Shoes - $3,500</p> <p>Then clicking on the "Shirts" slice would display detailed information about sales in the Shirts category:</p> <p>T-Shirts - $7,000 Polo Shirts - $2,000 Tank Tops - $1,000</p> <p>I have a basic example here using a data source that returns random information:</p> <p><a href="http://jsfiddle.net/informationarchitech/BrMeh/" rel="nofollow">http://jsfiddle.net/informationarchitech/BrMeh/</a></p> <pre><code>Ext.onReady(function () { var level = 1; Ext.define('Report', { extend: 'Ext.data.Model', fields: [{ name: 'category', type: 'string' }, { name: 'purchases', type: 'string' }], }); var store = Ext.create('Ext.data.Store', { id: 'store', model: 'Report', autoLoad: true, proxy: { type: 'jsonp', url: 'http://informationarchitech.com/demos/rand.php', reader: { root: 'content', } } }); Ext.create('Ext.chart.Chart', { renderTo: Ext.getBody(), width: 500, height: 350, animate: true, store: store, series: [{ listeners: { itemmousedown: function (obj) { level++; store.getProxy().url = 'http://informationarchitech.com/demos/rand.php?parent=' + obj.storeItem.data['category'] + '&amp;level=' + level; store.load(); } }, type: 'pie', angleField: 'purchases', showInLegend: true, label: { field: 'category', display: 'rotate', contrast: true, font: '18px Arial' } }] }); }); </code></pre> <p>As you can see, clicking on a slice results in inconsistent behavior. Sometimes it seems to update correctly, but often it seems to somehow be merging or overwriting the previous data.</p> <p>I have tried every "clear," "update," "reset" method I can find, on the chart, the store, etc, and nothing I have tried seems to successfully "fully" update the pie chart with the new data. Can anyone tell me what I am doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload