Hello,
Does anyone know how to use the source as xamPivotDataSelector, for xamPieChart? I've done it with xamDataChart but with xamPieChart i´m not getting positive results. The examples I have seen are all created with a class in C # (Data Model) and are ad hoc. My application is all in XAML, so I wanted to do this in the same language without using C #. Is it possible? Thank you
sseixas
Hello sseixas,
I have been looking into your enquiry and I did have to double-check on that, however the XamPieChart is not designed to work with pivot data. I was also wondering, on how would you be using the XamPieChart with such data and the olap data is designed to provide drilldown behavior as the XamPivotGrid’s dimensions do. If you could please explain your intention in more details I might be able to figure something out.
Looking forward to hearing from you.
Thanks for the response Petar Monov I explained myself badly, what I want is to use the data to populate a XamPivotGrid XamPieChart, like I do with XamDataChart. Is it possible?
my code is:
<UserControl x:Class="Eticadata_2.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" mc:Ignorable="d" d:DesignHeight="542" d:DesignWidth="1273" xmlns:olap="http://schemas.infragistics.com/olap" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:m="clr-namespace:Infragistics.Controls.Charts;assembly=InfragisticsSL5.Controls.Charts.OlapAxis.v11.2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" DataContext="{Binding}"> <Grid x:Name="LayoutRoot"> <Grid.ColumnDefinitions> <ColumnDefinition Width="888*" /> <ColumnDefinition Width="0*" /> </Grid.ColumnDefinitions> <Grid.Resources> <olap:XmlaDataSource x:Key="xmlaDataSource" ServerUri="http://localhost/olap/msmdpump.dll" > </olap:XmlaDataSource> </Grid.Resources> <TextBlock Height="Auto" Margin="7,25,9,0" Name="textBlock1" Text="XXXXX" VerticalAlignment="Top" FontWeight="Bold" FontSize="13" TextAlignment="Center" Foreground="Cornsilk" /> <Image Height="32" HorizontalAlignment="Left" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="90" Margin="8,4,0,0" Source="XXXXX" /> <sdk:TabControl Height="488" HorizontalAlignment="Left" Margin="0,42,0,0" Name="tabControl1" VerticalAlignment="Top" Width="1264"> <sdk:TabItem Header="Selecionar Opções" Name="tabItem1"> <Grid> <ig:XamPivotDataSelector HorizontalAlignment="Stretch" Margin="3,0,0,6" Name="xamPivotDataSelector1" VerticalAlignment="Stretch" DataSource="{StaticResource xmlaDataSource}" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" /> </Grid> </sdk:TabItem> <sdk:TabItem Header="Dados: Tabela" Name="tabItem2"> <Grid> <ig:XamPivotGrid DataContext="{Binding}" DataSource="{StaticResource xmlaDataSource}" HorizontalAlignment="Right" HorizontalContentAlignment="Stretch" Margin="0,1,0,6" Name="xamPivotGrid1" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Width="1251" /> </Grid> </sdk:TabItem> <sdk:TabItem Header="Dados: Gráfico de barras" Name="tabItem3"> <ig:XamDataChart x:Name="xmOlapDataChart1" Height="402" Width="1254" IsEnabled="True" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsSquare="False" VerticalZoombarVisibility="Visible" HorizontalZoombarVisibility="Visible" HorizontalZoomable="True" VerticalZoomable="True"> <ig:XamDataChart.Axes> <m:OlapXAxis x:Name="olapXAxis" DataSource="{StaticResource xmlaDataSource}" OlapAxisSource="Rows" YAxis="{Binding ElementName=yAxis}" AutoGenerateSeries="True"/> <ig:NumericYAxis Name="yAxis"/> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:OlapColumnSeries Title="Series1" YAxis="{Binding ElementName=yAxis}" OlapXAxis="{Binding ElementName=olapXAxis}" ValueMemberPath="Europe"/> <ig:OlapColumnSeries Title="Series2" YAxis="{Binding ElementName=yAxis}" OlapXAxis="{Binding ElementName=olapXAxis}" ValueMemberPath="Units"/> </ig:XamDataChart.Series> </ig:XamDataChart> </sdk:TabItem> </sdk:TabControl> <Grid.Background> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="#00CC7931" Offset="1" /> </LinearGradientBrush> </Grid.Background> </Grid></UserControl>
best regard
Excuse me for the late reply, I had to investigate this more thoroughly and was finally able to create a sample project (PivotAndChart.zip) that does what you want. What I did was to register for the XamPivotGrid’s DataSource’s ResultChanged event, and in its handler dynamically create an ObservableCollection that can be used for the XamPieChart:
Please let me know if you require any further clarification on the matter.
Hi Petar,
Thanks for providing the code. However when i try to run the project i get an error saying
Error 1 Cannot implicitly convert type 'System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs>' to 'System.EventHandler<Infragistics.Olap.ResultChangedEventArgs>'
Below is the error line of code.
pivotGrid.DataSource.ResultChanged += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(DataSource_ResultChanged);
Can you help me out.
Regards,
Yohan
Hello Yohan,
Thank you for your post. I have been looking into it and I modified the sample Peter has uploaded, so now it works correctly. Basically I changed the way the DataSource’s ResultChanged event was handled.
Hope this helps you.