PDA

View Full Version : Dynamic json chart



techillin
15 Dec 2011, 1:50 AM
I'm trying to use Sencha Touch Charts with a JSONStore to dynamically display a chart from information provided by JSON, series and data. This was possible with ExtJS 3 with the metaData property.


How can I accomplish the same with Sencha Touch Charts?

mitchellsimoens
15 Dec 2011, 10:20 AM
Load the store outside the chart and when the store loads, create the chart.

techillin
18 Dec 2011, 9:26 AM
I'm sorry but I can't get it to work. A simple example would be nice.

I wan't someting like this to produce a chart, none of the fields (except timestamp) can be hardcoded because it needs to be fullt dynamic.


{ "metaData": {
"root": "series",
"fields": [{
"name": "timestamp"
}, {
"name": "Unit 1",
"mapping": 2345
}, {
"name": "Unit 2",
"mapping": 5647
}, {
"name": "Unit 3",
"mapping": 1436
}]
},
"series": [{
"timestamp": "Jan",
"1436": 10,
"5647": 6,
"2345": 4
}, {
"timestamp": "Feb",
"2345": 10,
"1436": 9,
"5647": 7
}, {
"timestamp": "Mar",
"2345": 10,
"5647": 7,
"1436": 4
}]
}

m4manas
22 Mar 2012, 8:33 PM
What if i want the labels also to be dynamic not hard coded?

How do i refresh and reload the data. Say i reload the store with new data. How do i rerender the chart.

mitchellsimoens
23 Mar 2012, 4:35 AM
What if i want the labels also to be dynamic not hard coded?

How do i refresh and reload the data. Say i reload the store with new data. How do i rerender the chart.

The chart should hear when the store loads. The examples have a refresh button that simulates this.

shydreamz
2 Aug 2012, 10:59 PM
The chart should hear when the store loads. The examples have a refresh button that simulates this.

@simon i am afraid then when a store calls a loadData the chart is refreshed but it does not update the series in the charts and so if we have added a new data or field in the store then the chart does not reflect this change is only redraws or refreshes the chart with same old store data..

i tries this with sencha 4.0.1 charts and also on touch chars