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

      0  

    Default Unanswered: Displaying Pie Chart Percentages

    Unanswered: Displaying Pie Chart Percentages


    My question is simple. How do I display (or get the value of) the percentages of each item in a pie graph? (Doesn't matter if it happens on click or it displays them in labels on render). Is there a way of displaying percentages so that they dynamically change when an item disappears by clicking on the legend?

    I've read similar questions, but it seems like everyone just keeps saying, "just use renderer", which is fine and all but my problem isn't really displaying the percentage as much as it is getting the values themselves.

    Thanks.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,085
    Vote Rating
    453
    Answers
    3153
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Have you tried using the iteminfo interaction? Check out the Pie example.
    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. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    14
    Vote Rating
    0
    Answers
    2
    jcorredor is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Have you tried using the iteminfo interaction? Check out the Pie example.
    Thanks for you answer mitchellsimoens.

    I have used iteminfo as it is an excellent way of displaying information about the item. But, that is exactly my problem. I don't know how to GET the percentages in the first place. If I were to find the sum of the values stored and simply apply: (item value/ total sum) * 100%, it would simply give me the percentage of the item as long as all items are visible.

    However, when clicking on an item in the legend, the item now occupies a different percentage of the total as it becomes invisible. The iteminfo should take this into account and display a different percentage. How is this done?

    For example: I have a pie with... red:50%, yellow:25%, blue: 25%. Now I click on red in the legend... I should have yellow:50%, blue:50%. My question is, what function can I use or what Sencha field is available so that I may CALCULATE or GET the percentage dynamically?

Tags for this Thread