-
3 Nov 2011 1:36 AM #1
Unanswered: Bar chart problem with external store
Unanswered: Bar chart problem with external store
Hi guys! I have the problem: when i use fixed data for the store everything works fine, but when i am trying to get data via proxy - does nothing. Here is my code for the store and cahrt
json returnPHP Code:var store = new Ext.data.Store( {
fields: ['name','data1'],
proxy: {
type: 'ajax',
url: data_url,
reader: 'json' },
autoLoad:true });
var chart = {
xtype: "chart", theme: "Stats", store: store, width: 300, height: 500, animate: true,
axes: [
{ type: "Category", position: 'left', title: "Places", fields: [ "name" ] },
{ type: "Numeric", position: 'bottom', title: "CTR", fields: [ "data1" ], grid: true, minimum: 0 } ],
series: [
{type: "bar", axis: "bottom", xField: "name", yField: ["data1"],
tips: { trackMouse: true, width: 140, height: 28,
renderer: function(storeItem) { this.setTitle(storeItem.get('data1') + ' data1') } } } ] };
return chart;
Please guys help me! I've been stucked with this for 3 daysPHP Code:[ {"name":"banner_1","data1":0.15}, {"name":"banner_2","data1":0.12}]
-
3 Nov 2011 6:10 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Have you checked out the examples? I made the custom bar chart to work with your data.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Nov 2011 6:12 AM #3
Sure I read it. But in the example is used fixed json data. In such case my charts are working, but when i change it to proxy, it stop working! this is the point
-
3 Nov 2011 6:16 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Nov 2011 6:17 AM #5
-
3 Nov 2011 6:23 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Nov 2011 6:25 AM #7
my code above is the same, and my charts are not working. php script return valid json string. What's wrong? i dont know how to make it work. I tried everthing i found but nothing is working
-
3 Nov 2011 6:28 AM #8Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Are you getting an error? Maybe that renderer is not defined on your category axis?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Nov 2011 6:31 AM #9
no error. i defined series with renderer
Code:series: [{ type: 'bar', axis: 'bottom', highlight: true, tips: { trackMouse: true, width: 140, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('data1') + ': ' + storeItem.get('data2') + ' views'); } }, xField: 'data1', yField: ['data2'] }]
-
3 Nov 2011 10:10 PM #10Ext JS Premium Member
- Join Date
- Jan 2008
- Location
- Germany, Berlin
- Posts
- 123
- Vote Rating
- 7
- Answers
- 18
Please compare both JSON returns if they are exactly the same. I once had a similar issue where the proxy returned my numeric values encoded as string. This yielded to a not shown bar chart. When I changed the field definition to int in the model everything was working again.


Reply With Quote