473,498 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Pie series to Chart

Sl1ver
196 New Member
I have a chart in xaml and binding data to it at the back, what im currently finding is that it adds the data to the legend but doesn't actually produce a pie chart

xaml
Expand|Select|Wrap|Line Numbers
  1. <!--Begin Custom Tab Item-->
  2.                         <sdk:TabItem  Name="CustomTabItem" Cursor="Hand" Visibility="Visible">
  3.                             <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  4.                                 <Grid.RowDefinitions>
  5.                                     <RowDefinition Height="*" MaxHeight="300" />
  6.                                     <RowDefinition Height="Auto" />
  7.                                 </Grid.RowDefinitions>
  8.                                 <charting:Chart x:Name="SamplePieChart" Title="Sample Pie Chart" BorderThickness="0"                                              
  9.                                                 MaxHeight="300"
  10.                                                 HorizontalAlignment="Stretch"
  11.                                                 VerticalContentAlignment="Top"/>
  12.                                 <TextBlock Text="This is for testing purposes" 
  13.                                     Margin="10,10,10,20" FontSize="10" TextWrapping="Wrap"
  14.                                     Grid.Row="1" />
  15.                             </Grid>
  16.                         </sdk:TabItem>
Data
Expand|Select|Wrap|Line Numbers
  1. ChartItems = new KeyValuePair<string, int>[4];
  2.  
  3.             ChartItems[0] = new KeyValuePair<string, int>("Lorem ipsum dolor sit amet", 20);
  4.             ChartItems[1] = new KeyValuePair<string, int>("Maecenas iaculis dapibus", 90);
  5.             ChartItems[2] = new KeyValuePair<string, int>("Nulla facilisi. Curabitur laoreet", 112);
  6.             ChartItems[3] = new KeyValuePair<string, int>("Pellentesque non turpis elit", 160);
Code Behind
Expand|Select|Wrap|Line Numbers
  1. Chart pie = MapApplication.Current.FindObjectInLayout("SamplePieChart") as Chart;
  2.                     pie.Series.Clear();
  3.                     var Series = new PieSeries();
  4.                     Series.ItemsSource = ChartItems;
  5.                     Series.IndependentValueBinding = new Binding("Key");
  6.                     Series.DependentValueBinding = new Binding("Value");
  7.                     pie.Series.Add(Series);
May 30 '13 #1
0 6215

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2519
by: farrell77 | last post by:
I have a pivot chart that displays 3 data series. Series 1 values range from 17 to 106. Series 2 values range from 1 to 18. Series 3 values range from 0 to 1. When I display all three series...
22
6738
by: PeteCresswell | last post by:
I've been to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp, but still don't have a clue. For example, I've got a chart object namde...
1
1981
by: andreas | last post by:
Hi, I can not add a chart to a word document I have the following code ...... ....... xlblad.Range("A1:B3").Select()
1
7611
by: Robin Tucker | last post by:
Heres and interesting problem: I have a VB.NET program that creates reports via. Word Automation. This all works fine. What I want to do as part of this report generation process is to embed a...
8
12418
by: dkelly | last post by:
I wish to create a report with a chart, but I want to use a SQL statement as the source of the data, using VBA code in the reports load event I found the following snippet Dim objGraph As...
4
5872
by: keirnus | last post by:
Hello, I've been coding in Access VBA to create an Excel Graph and it was good. Until I got this error: Please check the code below: Private Sub TestGraph3()
1
4996
by: cubekid | last post by:
I am using OWC 11 in my new web application for displaying charts. Is it possible in OWC 11 to combine and display a column and a line graph (Looking like they overlap each other)? I tried it using...
0
1186
MitchR
by: MitchR | last post by:
Hello all! I am in need of some guidance .... please! I am able to place a single series of chart data with my code but I cannot for the life of me figure out how to add a second series. I can add...
0
1437
by: ian dean | last post by:
I need to add a polygon to a data series in mschart. I have tried the following:- ...using Systems.Windows.Forms; ... formGraphics.FillPolygon(myBrush,MyCurve); {this works OK but on a plain...
1
1701
by: munkee | last post by:
I cant figure out how to construct a query for my pivot chart in access. I basically have the following table: tblCorrective CorrectiveLinkID - Number - FK CorrectiveActionID - Autonumber...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4908
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.