Good day All,
I have a XamDataChart inside a XamTileManager to display employee statistics, specifically using a graph.
I am binding to a object populated via a WCF service, but nothing is displayed on the graphs.
I have set the DataContext of the Tile Manager, and the data chart does get bound to the data, but nothing is being displayed.
I am also attaching a snippet containing the XAML code (the binding object "Provider.WorkBenchPerformanceStatistics.WorkbenchLAPerformance" is a reference to an IList of a type received from a WCF service, also the items in the textblocks are displayed without issue):
<ig:XamTileManager Width="Auto" Name="xtmLegalWallboardBottom" Margin="0,522,12,-427" ItemsSource="{Binding Path=Provider.WorkBenchPerformanceStatistics.WorkbenchLAPerformance, Mode=TwoWay}"> <ig:XamTileManager.ItemTemplateMinimized> <DataTemplate> <TextBlock Name="tbName" Text="{Binding StaffFullName}" /> </DataTemplate> </ig:XamTileManager.ItemTemplateMinimized> <ig:XamTileManager.ItemTemplate> <DataTemplate> <TextBlock Name="tbName" Text="{Binding StaffFullName}" /> </DataTemplate> </ig:XamTileManager.ItemTemplate> <ig:XamTileManager.ItemTemplateMinimizedExpanded> <DataTemplate> <TextBlock Name="tbName" Text="{Binding StaffFullName}" /> </DataTemplate> </ig:XamTileManager.ItemTemplateMinimizedExpanded> <ig:XamTileManager.ItemTemplateMaximized> <DataTemplate> <Grid Name="grdWorkbench" Width="Auto" Height="Auto"> <ig:XamDataChart Name="xdcWorkbenchCounts" HorizontalZoomable="True" HorizontalZoombarVisibility="Collapsed" VerticalZoomable="True" VerticalZoombarVisibility="Collapsed" DataContext="{Binding}" Visibility="Visible" Height="100" Width="400" VerticalAlignment="Top"> <ig:XamDataChart.Axes> <ig:CategoryXAxis x:Name="BarXAxisCases" Width="Auto" Label="{}{StaffFullName}" LabelSettings="{StaticResource AxisLabelSettings}" /> <ig:NumericYAxis x:Name="BarYAxisCases" Width="Auto" Margin="5" Label="{}{}" LabelSettings="{StaticResource AxisLabelSettings2}" /> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:ColumnSeries Title="Open Case Count" ValueMemberPath="OpenCaseCount" XAxis="{Binding ElementName=BarXAxisCases}" YAxis="{Binding ElementName=BarYAxisCases}"> <ig:ColumnSeries.Brush> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#FFf79036" /> <GradientStop Color="#FFe3720c" Offset="1" /> </LinearGradientBrush> </ig:ColumnSeries.Brush> </ig:ColumnSeries> <ig:ColumnSeries Title="Converted Case Count" ValueMemberPath="ConvertedCaseCount" XAxis="{Binding ElementName=BarXAxisCases}" YAxis="{Binding ElementName=BarYAxisCases}"> <ig:ColumnSeries.Brush> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#FFf79036" /> <GradientStop Color="#FFe3720c" Offset="1" /> </LinearGradientBrush> </ig:ColumnSeries.Brush> </ig:ColumnSeries> </ig:XamDataChart.Series> </ig:XamDataChart> </Grid> </DataTemplate> </ig:XamTileManager.ItemTemplateMaximized> </ig:XamTileManager>
Hello Jav,
Thank you for sharing this. I believe that the other community members may benefit from this as well.
Thanks again.
Hi
I had a similar issue and in my case I found that XamPieChart did bind properly to any object when it was placed inside a DataTemplate tags of the XamTileManager.
To illustrate;
The following code does NOT work;
<DataTemplate x:Key="NormalTemplate">
<ig:XamPieChart ItemsSource="{Binding Path=Products}" ValueMemberPath="Price" LabelMemberPath="ProductName"/>
</DataTemplate>
However the following works;
<ig:XamPieChart ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor ,AncestorType={x:Type Window}}, Path=Products}" ValueMemberPath="Price" LabelMemberPath="ProductName"/>
Hope this helps
Regards
Jav Ainesaz
Hello Eduard,
I can say that the ItemsSource property is IEnumerable type and it expects a sequence of objects, not a single one.
Hope this helps you.
Hi Stefan,
I've previously had all those fields set, same as in the examples above.
But nothing shows.
I've checked each control (series, chart, axis, etc) on whether or not the data is being bound, and everything is being bound correctly (using the DataContextChanging event).
Can this maybe have something to do with the fact that the XamDataChart requires a List object to bind to, instead of a singular object?
Thank you for your post. I have been looking into it and I can say that you have to set the ItemsSource Property of the ColumnSeries and CategoryXAxis. Here you can read more about using ColumnSeries:
http://help.infragistics.com/Help/Doc/Silverlight/2013.1/CLR4.0/html/xamDataChart_Column_Series.html
and here there is as live sample:
https://ko.infragistics.com/samples/silverlight/data-chart/#/gallery-category-series
Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.