jQuery UI Widgets Forums Chart Pie in Percentages

This topic contains 6 replies, has 2 voices, and was last updated by  arthipesa 9 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Pie in Percentages #66803

    arthipesa
    Participant

    Dear JQCharts Experts,

    I hope I posted in the right place to ask, I would like to create a full 100% pie charts, which I successfully did, but instead of values I would like to show the percentages of the slices in the label, in the example i only saw, yet I don’t see how to get the actual percentages proportion.

    formatFunction: function (value){
        if (isNaN(value)) return value;
    }
    Pie in Percentages #66804

    Peter Stoev
    Keymaster

    Hi arthipesa,

    Actually, this is demonstrated in the Chart’s first demo: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_pie_series.htm?arctic

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Pie in Percentages #66805

    arthipesa
    Participant

    HI Peter,

    Thanks but that’s not what I meant, I mean in the example the solution for showing number as percentages is only to add the suffix of “%”, which in that example the total of those are 100%, but in many case, the numbers provided as the data source isn’t actually two digits (in which supposedly total of 100).

    Original example:

    Internet Explorer, 33.3
    Firefox, 26.5
    Chrome, 25.4
    Safari, 7.0
    Opera, 4.6
    Other, 3.2

    What I meant as datasource are:

    Internet Explorer, 133.3
    Firefox, 126.5
    Chrome, 125.4
    Safari, 2317.0
    Opera, 3414.6
    Other, 4513.2
    Pie in Percentages #66807

    Peter Stoev
    Keymaster

    Hi arthipesa,

    Then, calculate the percentage. Sum all values and get the percentage of each value using Mathematics for percentage calculation.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Pie in Percentages #66808

    arthipesa
    Participant

    Yes Peter,
    I really would like to do so, but inside the var settings.
    Or is this mean that I can’t do something like

    formatFunction: function (value, total){
       return (value/total*100) + '%';
    }

    in the var settings?

    Best Regards,

    Pie in Percentages #66809

    Peter Stoev
    Keymaster

    Hi arthipesa,

    Chart does not calculate the total which means that your function definition is incorrect. You should write code which calculates Total.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Pie in Percentages #66810

    arthipesa
    Participant

    Okay, got that covered 🙂 thank you very much.

    Best Regards,

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.