Pie,spider mode,how can I set the ItemClick event on clicking the number

4 posts, 0 answers
  1. Jayny
    Jayny avatar
    2 posts
    Member since:
    Oct 2013

    Posted 29 Oct 2013 Link to this post

    Like the pic,because the part which shows 1 is two small,I hardly click on it,so I choose the spider mode,but I do wanna do something when clicking it,But how can I raise an event when I click the number,not on the part of the pie?
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 01 Nov 2013 Link to this post

    Hello Jayny,

    You need to set the IsHitTestVisible property of the SeriesItemLabel  so that the label can detect mouse events. This you can do with a style. Then, in the mouse button down event of the chart area you can check if the clicked element is a SeriesItemLabel and if it is - you can select/deselect the data point. I have attached a small project to demonstrate this.

    Regards,
    Petar Marchev
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jayny
    Jayny avatar
    2 posts
    Member since:
    Oct 2013

    Posted 03 Nov 2013 Link to this post

        Thanks for your advice,but I need to show each item's name and Count,so I created set SeriesMapping -> ItemMappings and,set DataPointMember of ItemMapping,just as following:
    <telerik:SeriesMapping>
                        <telerik:SeriesMapping.SeriesDefinition>
                            <telerik:PieSeriesDefinition>
                                <!--<telerik:PieSeriesDefinition.LabelSettings>
                                    <telerik:RadialLabelSettings SpiderModeEnabled="True" ShowConnectors="True" />
                                </telerik:PieSeriesDefinition.LabelSettings>-->
                            </telerik:PieSeriesDefinition>
                        </telerik:SeriesMapping.SeriesDefinition>
                        <telerik:SeriesMapping.ItemMappings>
                            <!--<telerik:ItemMapping FieldName="MsgTypeName" DataPointMember="Label"></telerik:ItemMapping>-->
                            <telerik:ItemMapping FieldName="Count" DataPointMember="YValue"></telerik:ItemMapping>
                            <telerik:ItemMapping FieldName="Name" DataPointMember="LegendLabel"></telerik:ItemMapping>
                        </telerik:SeriesMapping.ItemMappings>
                    </telerik:SeriesMapping>
    But the structure of the pie chart at the same time changed,the behavior seemed to disappear.@Petar Marchev
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 06 Nov 2013 Link to this post

    Hello Jayny,

    I am unsure why you were unable to successfully apply the solution at hand. I have attached a project based on your code where the approach is applied and when I click on an item's label - the pie slice is being selected as expected.

    Regards,
    Petar Marchev
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top