Silverlight 4, MVVM Binding, PieChart

3 posts, 0 answers
  1. qwer
    qwer avatar
    18 posts
    Member since:
    Oct 2010

    Posted 04 Jan 2011 Link to this post

    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. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 05 Jan 2011 Link to this post

    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
  3. qwer
    qwer avatar
    18 posts
    Member since:
    Oct 2010

    Posted 10 Jan 2011 Link to this post

    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

Back to Top