Note that there are some explanatory texts on larger screens.

plurals
  1. POdynamically changing chart series extjs 4
    primarykey
    data
    text
    <p>I'm using Extjs 4 with the MVC architecture.</p> <p>I have a python script that outputs this Json Data : </p> <pre><code>{ "data": [ { "inAnalysis": 3, "inQuest": 2, "inDevelopment": 6, "total": 12, "inValidation": 1, "Month": 1303 }, { "inAnalysis": 1, "total": 5, "Month": 1304, "inDevelopment": 4 } ], "success": true, "metaData": { "fields": [ { "name": "inAnalysis" }, { "name": "inQuest" }, { "name": "inDevelopment" }, { "name": "inValidation" }, { "name": "isDuplicate" }, { "name": "New" }, { "name": "total" } ], "root": "data" } </code></pre> <p>}</p> <p>I want the fields of my MetaData to be used as the chart series, so I have a store like this : </p> <pre><code>Ext.define('Proj.store.ChartData', { extend: 'Ext.data.Store', autoload: true, proxy: { type: 'ajax', url : 'data/getParams.py', reader: new Ext.data.JsonReader({ fields:[] }), root: 'data' } </code></pre> <p>And to add series to the chart I did this : </p> <pre><code>var chart = Ext.widget('drawchart'); var fields = []; chartStore.each(function (field) { fields.push(Ext.create('Ext.data.Field', { name: field.get('name') })); }); chartModel.prototype.fields.removeAll(); chartModel.prototype.fields.addAll(fields); var series = []; for (var i = 1; i &lt; fields.length; i++) { var newSeries = new Ext.chart.BarSeries({ type: 'column', displayName: fields[i].name, xField: ['Month'], yField: fields[i].name, style: { mode: 'stretch', color: this.chartColors[i + 1] } }); series.push(newSeries); chart.series = series; }; chart.bindStore(chartStore); chart.redraw(); chart.refresh(); </code></pre> <p>But It's not working, I think the fields array is always empty... Any help would be appreciated:</p>
    singulars
    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