I want to create pie chart in windows phone 8 application in visual studio 2013. Kindly guide me step by step how to use this third party tool and please tell me each step I have installed this controls but I dont know how to use this.
Hello Aamar,
Thank you for your post. I have been looking into your question and regarding the Windows Phone 8 development, you can ream detailed information on how you can start with Windows Phone 8 here: http://help.infragistics.com/doc/WindowsPhone/2014.1/CLR4.0?page=SL_DV_Getting_Started_Prerequisites.html.
Also, here: http://help.infragistics.com/doc/WindowsPhone/2014.1/CLR4.0?page=xamPieChart_Data_Binding.html, you can find detailed information on how you can create a XamPieChart and bind it to a collection.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir, MCPD
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
Hi Krasimir,
I followed your instructions but there is some error in my code kindly check my code and resolve my error. Error in <local:Data>
Error description: Data does not exist in the namespace "clr-namespace:phonechart"
in Xaml:
<UserControl x:Class="phonechart.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ig="clr-namespace:Infragistics.Controls.Charts;assembly=InfragisticsWP8.Controls.Charts.XamDataChart.v14.1" xmlns:local="clr-namespace:phonechart" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <local:Data x:Key="data" /> </Grid.Resources>
<ig:ItemLegend x:Name="Legend" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10" Padding="10,5,10,5" />
<ig:XamPieChart Name="pieChart" Grid.Row="2" ItemsSource="{StaticResource data}" LabelMemberPath="Label" ValueMemberPath="Value" ToolTip="{}{Label}" Legend="{Binding ElementName=Legend}" /> </Grid></UserControl>
in C#:
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Navigation;using Microsoft.Phone.Controls;using Microsoft.Phone.Shell;using phonechart.Resources;using System.Collections.ObjectModel;using Infragistics.Controls.Charts;using Infragistics.Collections;using System.ServiceModel;
namespace phonechart{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } }
public class DataItem { public string Label { get; set; } public double Value { get; set; } }
public class Data : ObservableCollection<DataItem> { public Data() { Add(new DataItem { Label = "Item 1", Value = 5 }); Add(new DataItem { Label = "Item 2", Value = 6 }); Add(new DataItem { Label = "Item 3", Value = 3 }); Add(new DataItem { Label = "Item 4", Value = 7 }); Add(new DataItem { Label = "Item 5", Value = 5 }); } }}
Hello Aamir,
In your code the Data class is a property of the MainPage as opposed to a separate class. In this instance you could set the DataContext of the Mainpage to itself:
this.DataContext = this
and bind the chart's ItemsSource directly to the Data property
ItemsSource={Binding Data}
otherwise you can create the collection outside of the MainPage and use your original binding.
Please let us know if you have any questions.
Valerie
Hi Valerie,
I didn't get your point kindly guide me each step should I follow.... I will be thankful to you
Thank you for your reply. I have created a sample application for you, that shows how you can use the XamPieChart in a Windows Phone 8 application.
I am just checking if you require any further assistance on the matter.
Thank you for your reply. The sample that I have attached is building and running correctly on my side. I have tested the sample on a device with Windows Phone 8 a and the sample application is running. I am attaching a screenshot made by the phone when the application is running.
I assume that it is possible the first two errors to be caused by the last error that that you are getting. Would you please test the sample on different device or an emulator and also, would you please let me know if you can run the sample without the XamPieChart?
Looking forward to hearing from you.
When I run the application which is created by you, there are some errors occured. Please tell me how to resolve these issues
Error 1 The name "ItemLegend" does not exist in the namespace "clr-namespace:Infragistics.Controls.Charts;assembly=InfragisticsWP8.Controls.Charts.XamDataChart.v14.1". D:\my stuff\windows phone apps\PhoneApp1\PhoneApp1\PhoneApp1\MainPage.xaml line 24 Column 9 PhoneApp1
Error 2 The name "XamPieChart" does not exist in the namespace "clr-namespace:Infragistics.Controls.Charts;assembly=InfragisticsWP8.Controls.Charts.XamDataChart.v14.1". D:\my stuff\windows phone apps\PhoneApp1\PhoneApp1\PhoneApp1\MainPage.xaml Line 31 Column 9 PhoneApp1
Error 3 Unable to install application. The maximum number of developer applications on this phone has been reached. Please uninstall a developer application and try again.