1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    14
    Vote Rating
    0
    Answers
    2
    jcorredor is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    No, you will need to create a new chart if you want to change the yField.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

Thread Participants: 1

Tags for this Thread