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

Pie Chart in MVVM

3 Answers 49 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Muthukumar
Top achievements
Rank 1
Muthukumar asked on 16 Nov 2011, 01:59 PM
hi team,
i need to develop a simple pie chart. but i have only below code in my Xaml. i need to create and control series from my viewmodel not in the code behind. And also i need to control the series colors, number of legends and legend colors from my viewmodel. if u guys give the sample code would be the great help. 

The idea is i need to have only one template and use that control as common control.
need to show that more that one pie chart in the same page.

 <telerik:RadChart x:Name="RadChart1" ItemsSource="{Binding Data}">
            <telerik:RadChart.DefaultSeriesDefinition>
                <telerik:PieSeriesDefinition>                
                </telerik:PieSeriesDefinition>
            </telerik:RadChart.DefaultSeriesDefinition>
        </telerik:RadChart>

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 21 Nov 2011, 11:46 AM
Hello Muthukumar,

You can find a similar example in our legend features demo - the Pie chart is created using MVVM, with different legend options. As for the series colors, please, refer to this example.

Best wishes,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Muthukumar
Top achievements
Rank 1
answered on 22 Nov 2011, 06:20 AM
hi ,
thanks for ur reply. In this above example i can bind the legends from viewmodel, but Color palettes are from code behind
i need that too from view model and another thing if i create color palettes from codebehind it is very slow. Is there any way to do that in viewmodel.



thanks, 
Muthukumar N
0
Nikolay
Telerik team
answered on 24 Nov 2011, 08:25 AM
Hi Muthukumar,

Yes, it is possible to bind the colors using MVVM as well - please, have a look at this thread for more information on the matter and sample code.

Kind regards,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Chart
Asked by
Muthukumar
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Muthukumar
Top achievements
Rank 1
Share this question
or