jQWidgets Forums

jQuery UI Widgets Forums Chart count pie chart numbers

This topic contains 5 replies, has 2 voices, and was last updated by  shawn 5 years, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • count pie chart numbers #106955

    shawn
    Participant

    I have a pie chart that looks like this:
    sample pie chart

    If I click one of the descriptions on the bottom, like “Consulting”, I can toggle that part of the chart on/off.

    I want to be able to re-total up the numbers on the chart every time a category is toggled on/off.

    How?

    count pie chart numbers #106962

    Martin
    Participant

    Hello shawn,

    You can bind to the toggle event of the chart so you can update your data as needed and refresh the chart.
    Please, take a look at the following Example.

    Best Regards,
    Martin

    jQWidgets Team
    https://www.jqwidgets.com/

    count pie chart numbers #106968

    shawn
    Participant

    Thank you.
    I ended up doing it this way:

    $('#repGraph').on('click', function(e){
    	tallyRCtotal();
     });

    then

    function tallyRCtotal(){
    	var counter=0;
    	$("#repGraph").find(".jqx-chart-label-text").each(function(){
    		counter+=parseInt( $(this).html() );
    	});	
    	
    	$("#rdrLen").html(counter.toString()+" records");
    }
    count pie chart numbers #106969

    shawn
    Participant

    Is there a way to toggle on all of these at once?

    bottom key

    count pie chart numbers #106983

    Martin
    Participant

    Hello shawn,

    Yes, you could use the showSerie and hideSerie methods.
    Please, take a look at the following Example.

    Best Regards,
    Martin

    jQWidgets Team
    https://www.jqwidgets.com/

    count pie chart numbers #106987

    shawn
    Participant

    perfect, thanks

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

You must be logged in to reply to this topic.