Home forums Report Bugs Legend Click on Pie

Tagged: , ,

This topic contains 4 replies, has 3 voices, and was last updated by  Cristi S. 1 month, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15542

    Cristi S.
    Member

    A click on a legend item, for a pie, will hide or show ALL data series. It will either hide or render the whole pie.

    To repro, copy and paste the itemclick event from Hide Unhide Data Series on Legend Click into a Pie chart like this one. Or take a look at my fiddle: http://jsfiddle.net/cristiscu/so6ao1gn/1/

    Cheers,
    Cristi

    #15545

    Suyash Singh
    Moderator

    Cristi,

    As of now, visible property is applicable only at dataSeries level. However, in pie and doughnut charts, the legends are shown for individual dataPoints rather than dataSeries. In your fiddle, you are hiding the entire dataSeries of pie chart, so the entire chart gets hidden.

    Instead, on legend click, you can manipulate the dataPoints and render the chart as per your requirement.
    ___
    Suyash Singh
    Team CavasJS

    #15547

    Cristi S.
    Member

    You’re right, Suyash, pie/doughnut charts are single series.

    Given this is a common requirement (many competitors implement this feature as built-in, see an example), I would truly appreciate a working sample, if you have better knowledge on how to manipulate those dataPoints. I tried without success.

    Thanks,
    Cristi

    • This reply was modified 1 month, 1 week ago by  Cristi S..
    • This reply was modified 1 month, 1 week ago by  Cristi S.. Reason: added example
    #15563

    Indranil Deo
    Member

    Cristi,

    You can achieve this by using itemclick in legend.

    Please take a look at this work-around

    #15568

    Cristi S.
    Member

    Brilliant! Thanks, Indranil.

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

You must be logged in to reply to this topic.