Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1065
Default others in jquery igpiechart
posted

I'm able to bind the data and display the piechart but default others is being added in the legend and chart. how can we remove this?

 

  • 1775
    Suggested Answer
    posted

    Hi, jpavansharma

    The default slice 'others' is added for all values which are too small to be depicted nicely on a pie chart. You have control over which values are grouped into the Others slice with the options othersCategoryThreshold and othersCategoryType. You can also use the othersCategoryText option to set alternative label for the others slice. You can see how to use them in the API Documentation.

    See here a short example of how you can configure these options: 

     

    1. $('#chart').igPieChart({
    2.     dataSource: data,
    3.     valueMemberPath: 'Budget',
    4.     labelMemberPath: 'Label',
    5.  
    6.     othersCategoryThreshold: 8,
    7.     othersCategoryType: "percent",
    8.  
    9.     legend: { element: 'legend', type: 'item' }
    10. });

    In this example all values below 8% of the total will be grouped in the others slice.

    Here follows another example that effectively switches off the others slice and depicts all slices no matter how small their values are:

     

    1. $('#chart').igPieChart({
    2.     dataSource: data,
    3.     valueMemberPath: 'Budget',
    4.     labelMemberPath: 'Label',
    5.  
    6.     othersCategoryThreshold: 0,
    7.     othersCategoryType: "number",
    8.  
    9.     legend: { element: 'legend', type: 'item' }
    10. });

    Hope this helps.

    Cheers, Lazar