This is a migrated thread and some comments may be shown as answers.

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

3 Answers 86 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jayny
Top achievements
Rank 1
Jayny asked on 30 Oct 2013, 01:38 AM
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?

3 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 01 Nov 2013, 09:06 AM
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 >>
0
Jayny
Top achievements
Rank 1
answered on 04 Nov 2013, 01:48 AM
    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
0
Petar Marchev
Telerik team
answered on 06 Nov 2013, 11:43 AM
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 >>
Tags
Chart
Asked by
Jayny
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Jayny
Top achievements
Rank 1
Share this question
or