Hi Team,
Is it possible to create a category series with dynamic series elements.
Below mentioned is the way my requirement of xam data chart should looks like.
In the below mentioned sample the series are predefined as 5 but as per my requirement the number of series are dynamic that are categorized by a fixed category.
Can you please provide a sample if you have any.Thanks in advance for all you do.
The below mentioned part needs to be dynamic where the value member path should be dynamic.
Sample code :
Title="{Binding StringEnergyCoal, Source={StaticResource DataViewModel}}" XAxis="{Binding ElementName=BarXAxis}" YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True"> Title="{Binding StringEnergyHydro, Source={StaticResource DataViewModel}}" XAxis="{Binding ElementName=BarXAxis}" YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True"> Title="{Binding StringEnergyNuclear, Source={StaticResource DataViewModel}}" XAxis="{Binding ElementName=BarXAxis}" YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True"> Title="{Binding StringEnergyGas, Source={StaticResource DataViewModel}}" XAxis="{Binding ElementName=BarXAxis}" YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True"> Title="{Binding StringEnergyOil, Source={StaticResource DataViewModel}}" XAxis="{Binding ElementName=BarXAxis}" YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">
Regards,
Sridhar.
Hi Sridhar,
If I understand the behavior that you are interested in achieving with the DataChart, it sounds like you want to dynamically modify the number of series during runtime and not necessarily change the ValueMemberPath for a given series?
Both behaviors are certainly possible as long as you are defining each of your series at some point and adding them to the chart’s Series collection or for the latter behavior, (if you really do want to modify the ValueMemberPath for your series during runtime) as long as an appropriate public property off of the underlying object is exposed, you can certainly change the path to some other value as well.
I’ve attached a basic sample for swapping out series, (as this scenario sounds closest to your goal) where categories are defined for energy sources and the series associated with specific country energy production are dynamically added and removed from the chart.
Please find the sample attached and if you have any further questions, or if I’ve misunderstood your intention, please let me know.
Chris K.
Hi Chris,
Thanks for your prompt response.But this is not exactly what i need .here is my requirement.
I have got a fixed number of rop (30,45,60,90).Consider these are category series.
Then i have got a dynamic number of reports each report has some report specific properties which i am displaying in the form of a tool tip for each report.
Each report falls under the mentioned categories(30,45,60,90) .
Note :Each report is dynamic .In the example you have provided the reports or chart elements are defined in the xaml .
The issue i am facing if i add the series dynamically i need to have a datatable with 4 rows that represent 4 categories and for each extra series(reports)
i need to add a column dynamically to the datatable and set the value .
So for each series (row) i have 4 columns that represent 4 reports with their values.
But the issue each report item has multiple values specific to that report such as colour,value and 5 to 6 properties which cannot be made as a single column value as per my requirement.Hope you understand my requirement .Thanks in advance fo all you do.
Xaml Code:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" >
<!--<Border Grid.Row="0" Height="{Binding ElementName=gdReportGraph,Path=Height}" BorderBrush="Black" BorderThickness="0.5" HorizontalAlignment="Stretch"
Margin="20,20,20,20" VerticalAlignment="Stretch" Visibility="Hidden" ></Border>-->
<Grid Name="GdReportGraph" Visibility="Visible" >
<Grid.Resources>
<ContentControl x:Key="VariationTooltip" >
<StackPanel Orientation="Vertical" Background="Transparent" >
<StackPanel Orientation="Horizontal">
<TextBlock Text="Service: " FontWeight="Bold" Foreground="Black"/>
<TextBlock Text="{Binding Item.ServiceName}" Foreground="Black" />
</StackPanel>
<TextBlock Text="Report: " FontWeight="Bold" Foreground="Black" />
<TextBlock Text="{Binding Item.ReportName}" Foreground="Black" />
<TextBlock Text="{Binding Item.ToolTipHeaderText}" FontWeight="Bold" Foreground="Black" />
<TextBlock Text="{Binding Item.DataDensityValue}" Foreground="Black" />
<TextBlock Text="Actual Value: " FontWeight="Bold" Foreground="Black" Visibility="{Binding Item.ToolTipVisibility}"/>
<TextBlock Text="{Binding Item.NormalizedUpdateRate}" Foreground="Black" Visibility="{Binding Item.ToolTipVisibility}"/>
<TextBlock Text="Difference: " FontWeight="Bold" Foreground="Black" Visibility="{Binding Item.ToolTipVisibility}"/>
<TextBlock Text="{Binding Item.DensityVariation}" Foreground="Black" Visibility="{Binding Item.ToolTipVisibility}"/>
<TextBlock Text="Repeats: " FontWeight="Bold" Foreground="Black" />
<TextBlock Text="{Binding Item.OptimizedSequence}" Foreground="Black" />
</ContentControl>
</Grid.Resources>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
<ig:XamDataChart x:Name="Chart" Margin="2,2,0,-200" Grid.Row="1" >
<ig:XamDataChart.Axes>
<ig:CategoryXAxis x:Name="XAxis" ItemsSource="{Binding ListOfReportDistribution,UpdateSourceTrigger=PropertyChanged}" Label="{}{RopReport}" Title="Reports" Overlap="1" >
<!--Label="{}{ReportName}"-->
<!--<ig:CategoryXAxis.LabelSettings >
<ig:AxisLabelSettings Angle="-60" VerticalAlignment="Center" TextAlignment="Justify" />
</ig:CategoryXAxis.LabelSettings>-->
</ig:CategoryXAxis>
<ig:NumericYAxis x:Name="YAxis" MinimumValue="0" MajorStrokeThickness="0" MinorStrokeThickness="0" Title="Data Density (pts/ft)" >
<ig:NumericYAxis.TitleSettings >
<ig:TitleSettings Angle="-90" Position="Auto" />
</ig:NumericYAxis.TitleSettings>
</ig:NumericYAxis>
</ig:XamDataChart.Axes>
<ig:XamDataChart.Series>
<ig:ColumnSeries Name="DensitySeries" Margin="0,0,0,0" ShowDefaultTooltip="True" HorizontalAlignment="Stretch" XAxis="{Binding ElementName=XAxis}" YAxis="{Binding ElementName=YAxis}"
ItemsSource="{Binding ListOfReportDistribution,UpdateSourceTrigger=PropertyChanged}" ValueMemberPath="DataDensityValue"
Thickness='0' MinWidth="200" Outline='Black' LegendItemVisibility="Visible" IsTransitionInEnabled="True" ToolTip="{StaticResource VariationTooltip}"
IsCustomCategoryStyleAllowed="True" AssigningCategoryStyle="ColumnSeries_AssigningCategoryStyle" >
<ig:ColumnSeries.LegendItemBadgeTemplate>
<DataTemplate>
</DataTemplate>
</ig:ColumnSeries.LegendItemBadgeTemplate>
</ig:ColumnSeries>
<ig:ColumnSeries Name="DensityVariationSeries" ShowDefaultTooltip="True" HorizontalAlignment="Stretch"
XAxis="{Binding ElementName=XAxis}" YAxis="{Binding ElementName=YAxis}"
ItemsSource="{Binding ListOfReportDistribution,UpdateSourceTrigger=PropertyChanged}" Brush="Transparent"
DashArray="20,2" ToolTip="{StaticResource VariationTooltip}" ToolTipService.IsEnabled="True"
AssigningCategoryStyle="ColumnSeries_AssigningCategoryStyle" ValueMemberPath="NormalizedUpdateRate"
MinWidth="200" Outline='Black' LegendItemVisibility="Visible" IsTransitionInEnabled="True" >
</ig:XamDataChart.Series>
</ig:XamDataChart>
</Grid>
<Grid Name="ReportGraphRop" >
<ContentControl x:Key="VariationTooltipRop" >
<ig:XamDataChart x:Name="DataChartRop" Visibility="Hidden" >
<ig:CategoryXAxis x:Name="Xaxis" ItemsSource="{Binding DefaultView}" Label="{}{RopReport}" Title="Reports"/>
<ig:NumericYAxis x:Name="Yaxis" MinimumValue="0" MajorStrokeThickness="0" MinorStrokeThickness="0" Title="Data Density (pts/ft)" >
<ig:XamDataChart.Series >
<ig:ColumnSeries Margin="0,0,0,0" Name="DensitySeriesRop" ShowDefaultTooltip="True" HorizontalAlignment="Stretch"
XAxis="{Binding ElementName=XAxis}" YAxis="{Binding ElementName=YAxis}" ItemsSource="{Binding DefaultView}" ValueMemberPath="DataDensityValue"
Thickness='0' Outline='Black' LegendItemVisibility="Visible" IsTransitionInEnabled="True" ToolTip="{StaticResource VariationTooltipRop}"
IsCustomCategoryStyleAllowed="True" AssigningCategoryStyle="ColumnSeries_AssigningCategoryStyleBasedonRop" >
Sridhar