PDA

View Full Version : Split data from JSON for chart



leejwright
3 Jun 2015, 3:37 PM
Hi,

I want to send data down to a chart that has some filter info (that I'll put in the chart title) and the actual data.

{
"data": [
{
"scale": -3,
"measure": "Basic Tee",
"value": 101740.90661659864
},
{
"scale": -3,
"measure": "Fashion Knit Tops",
"value": 81559.21146309843
},
{
"scale": -3,
"measure": "Polo Shirts",
"value": 34743.9764527008
}
],
"filter": {
"test": "testing"
}
}

If i set the root for the proxy I can get the data fine but not the filter.



reader: {
type: 'json'
, root: 'data'
},

How do I get access to both?

Thanks

lee

joel.watson
3 Jun 2015, 5:57 PM
Hi--

One way you can do this is to retrieve the data from the proxy's reader. Here's an example:

https://fiddle.sencha.com/#fiddle/o15

You could additionally load the data via Ext.Ajax.request(...), and then load the store with the data when the request is received, storing both sets of data however you'd like within your application.

I hope that helps!
Thanks
Joel