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

Silverlight 4, MVVM Binding, PieChart

2 Answers 135 Views
Chart
This is a migrated thread and some comments may be shown as answers.
qwer
Top achievements
Rank 1
qwer asked on 04 Jan 2011, 07:22 AM
Hi there,
    I'm facing three issues as, (as MVVM, I'm not using CodeBehind)
    I've single row result set, which query back from Domain Service. How do i bind that 1 row data into PieChart (I want to show Column name as Legend)?
    Another question is, How can I show % information beside Legend name? (eg, First Test 20.00% in ledgent area)
    Last question is, How can I bind that % information into Textbox beside Legend.


Here is my Code (but not working)
<telerik:RadChart ItemsSource="{Binding Path=TestResultDataSets}"
                              Name="PieTestResult">
                <telerik:RadChart.SeriesMappings>
                    <telerik:SeriesMapping>
                        <telerik:SeriesMapping.SeriesDefinition>
                            <telerik:SeriesMapping>
                                <telerik:SeriesMapping.SeriesDefinition>
                                    <telerik:PieSeriesDefinition ShowItemToolTips="True"
                                                                 ItemLabelFormat="#%{p}"
                                                                 ItemToolTipFormat="#LEGENDLABEL - #%{P}"
                                                                 LegendItemLabelFormat="#%{p}">
                                        <telerik:PieSeriesDefinition.InteractivitySettings>
                                            <telerik:InteractivitySettings HoverScope="Item" />
                                        </telerik:PieSeriesDefinition.InteractivitySettings>
                                        <telerik:PieSeriesDefinition.LabelSettings>
                                            <telerik:RadialLabelSettings ShowConnectors="True"
                                                                         SpiderModeEnabled="True"
                                                                         Distance="20" />
                                        </telerik:PieSeriesDefinition.LabelSettings>
                                    </telerik:PieSeriesDefinition>
                                </telerik:SeriesMapping.SeriesDefinition>
                                <telerik:SeriesMapping.ItemMappings>                                   
                                    <telerik:ItemMapping DataPointMember="FirstTest"
                                                         FieldName="FirstTest"></telerik:ItemMapping>
                                    <telerik:ItemMapping DataPointMember="SecondTest"
                                                         FieldName="SecondTest"></telerik:ItemMapping>
                                    <telerik:ItemMapping DataPointMember="ThirdTest"
                                                         FieldName="ThirdTest"></telerik:ItemMapping>
                                    <telerik:ItemMapping DataPointMember="FourthTest"
                                                         FieldName="FourthTest"></telerik:ItemMapping>
                                </telerik:SeriesMapping.ItemMappings>
                            </telerik:SeriesMapping>
                </telerik:RadChart.SeriesMappings>
            </telerik:RadChart>

and I don't know how to show % beside Legend and how to put TestBox for That % information at Legend Area.

Please advise and I'm uploading sketch images.
Thanks.

2 Answers, 1 is accepted

Sort by
0
Evgeni "Zammy" Petrov
Telerik team
answered on 05 Jan 2011, 09:21 AM
Hi qwer,

 1. How do i bind that 1 row data into PieChart (I want to show Column name as Legend)?
I am not sure what you are using to get the data but  here is a nice blog post about using RIA services with RadChart: http://blogs.telerik.com/vladimirmilev/posts/10-07-15/silverlight_radchart_codeless_binding_to_ria_services_domaindatasource.aspx

2.How can I show % information beside Legend name? (eg, First Test 20.00% in ledgent area)
This is not supported by the RadChart legend. What I would do is put the chart in a canvas, then put a grid in the canvas and position it just next to the legend. Make 4 row grid and put the information you want into labels.

3.How can I bind that % information into Textbox beside Legend.
I believe this is the same question as the second one. When you get a DomainDataSource object as a DataContext for the whole form you can easily bind it to any UI element. I believe that a grid with labels is a better option than a textbox.

Regards,

Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
qwer
Top achievements
Rank 1
answered on 11 Jan 2011, 03:01 AM
Hi Zammy,
   Thanks for your reply and
   I follow the link for % on ledgent, which is nice and sorted out
   rest of the issue, I did with put those in Grid. show side by side.

Thanks

Tags
Chart
Asked by
qwer
Top achievements
Rank 1
Answers by
Evgeni "Zammy" Petrov
Telerik team
qwer
Top achievements
Rank 1
Share this question
or