Results 1 to 2 of 2

Thread: Dynamically Changing the yField possible?

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    14
    Answers
    2
    Vote Rating
    -1
      0  

    Default 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...

    Code:
    fields: ['name', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012'],
    each field will have different categories, so '2000', for example, will contain a value for say 'water', 'land', 'air'.

    in my line graph..
    Code:
    var date = 2000;
    ...
    Code:
    changeDate: function(newDate) {
            date = newDate;
    in the series field..
    Code:
    yField: [date]
    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.

    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?

  2. No, you will need to create a new chart if you want to change the yField.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    No, you will need to create a new chart if you want to change the yField.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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 in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •