-
26 Jun 2012 8:30 AM #1
Answered: Dynamically Changing the yField possible?
Answered: Dynamically Changing the yField possible?
I'm trying to make the data change in my line graph dynamically. I have it all under one store, where each year is a field as well as one field for the name of the category like so...
each field will have different categories, so '2000', for example, will contain a value for say 'water', 'land', 'air'.Code:fields: ['name', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012'],
in my line graph..
...Code:var date = 2000;
in the series field..Code:changeDate: function(newDate) { date = newDate;
This seems to work for the first value I give to date, however, every time I call changeDate, the graph does not update with the new yField. Is there anything I have to do to refresh the graph so that it accepts a new value for the yField? Or is the yField a set value that does not change after the graph is rendered? I have tried redraw(), but the graph does not change.Code:yField: [date]
side note: This is similar to what EnergyChart does with the year graph. However, they change the content of their store every time. Is this the only solution to dynamic graphing?
-
Best Answer Posted by mitchellsimoens
No, you will need to create a new chart if you want to change the yField.
-
28 Jun 2012 6:48 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
No, you will need to create a new chart if you want to change the yField.
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.


Reply With Quote