Hello. I'm using RadCartesianChart to show some data in Stacked Bar Series. I want to have dynamic number of series and for that i use
RadCartesianChart.SeriesProvider. I want to bind legend to my chart but legend doesn't display at the window. Here is snippets of code that i use in XAML:
<telerik1:RadCartesianChart x:Name="Chart"
Grid.Row="1"
Palette="Arctic">
<telerik1:RadCartesianChart.HorizontalAxis>
<telerik1:CategoricalAxis />
</telerik1:RadCartesianChart.HorizontalAxis>
<telerik1:RadCartesianChart.VerticalAxis>
<telerik1:LinearAxis />
</telerik1:RadCartesianChart.VerticalAxis>
<telerik1:RadCartesianChart.Grid>
<telerik1:CartesianChartGrid StripLinesVisibility="Y">
<telerik1:CartesianChartGrid.YStripeBrushes>
<SolidColorBrush Color="#F2F2F2" />
<SolidColorBrush Color="Transparent" />
</telerik1:CartesianChartGrid.YStripeBrushes>
</telerik1:CartesianChartGrid>
</telerik1:RadCartesianChart.Grid>
<telerik1:RadCartesianChart.SeriesProvider>
<telerik1:ChartSeriesProvider Source="{Binding DailyDatas}">
<telerik1:ChartSeriesProvider.SeriesDescriptors>
<telerik1:CategoricalSeriesDescriptor CategoryPath="HourName"
ItemsSourcePath="Data"
ValuePath="Value">
<telerik1:CategoricalSeriesDescriptor.Style>
<Style TargetType="telerik1:BarSeries">
<Setter Property="CombineMode" Value="Stack" />
</Style>
</telerik1:CategoricalSeriesDescriptor.Style>
</telerik1:CategoricalSeriesDescriptor>
</telerik1:ChartSeriesProvider.SeriesDescriptors>
</telerik1:ChartSeriesProvider>
</telerik1:RadCartesianChart.SeriesProvider>
</telerik1:RadCartesianChart>
<telerik1:RadLegend Items="{Binding ElementName=Chart, Path=LegendItems}"/>
DailyDatas is an ObservableCollection of DailyData:
public class HourInfo
{
public string HourName { get; set; }
public double? Value { get; set; }
}
public class DailyData
{
public string RoleName { get; set; }
public ObservableCollection<HourInfo> Data { get; set; }
}
What am i doing wrong? Maybe there is another way to make dynamic number of stacked bar series?
Suggest me please asap! Thank you in advance!
RadCartesianChart.SeriesProvider. I want to bind legend to my chart but legend doesn't display at the window. Here is snippets of code that i use in XAML:
<telerik1:RadCartesianChart x:Name="Chart"
Grid.Row="1"
Palette="Arctic">
<telerik1:RadCartesianChart.HorizontalAxis>
<telerik1:CategoricalAxis />
</telerik1:RadCartesianChart.HorizontalAxis>
<telerik1:RadCartesianChart.VerticalAxis>
<telerik1:LinearAxis />
</telerik1:RadCartesianChart.VerticalAxis>
<telerik1:RadCartesianChart.Grid>
<telerik1:CartesianChartGrid StripLinesVisibility="Y">
<telerik1:CartesianChartGrid.YStripeBrushes>
<SolidColorBrush Color="#F2F2F2" />
<SolidColorBrush Color="Transparent" />
</telerik1:CartesianChartGrid.YStripeBrushes>
</telerik1:CartesianChartGrid>
</telerik1:RadCartesianChart.Grid>
<telerik1:RadCartesianChart.SeriesProvider>
<telerik1:ChartSeriesProvider Source="{Binding DailyDatas}">
<telerik1:ChartSeriesProvider.SeriesDescriptors>
<telerik1:CategoricalSeriesDescriptor CategoryPath="HourName"
ItemsSourcePath="Data"
ValuePath="Value">
<telerik1:CategoricalSeriesDescriptor.Style>
<Style TargetType="telerik1:BarSeries">
<Setter Property="CombineMode" Value="Stack" />
</Style>
</telerik1:CategoricalSeriesDescriptor.Style>
</telerik1:CategoricalSeriesDescriptor>
</telerik1:ChartSeriesProvider.SeriesDescriptors>
</telerik1:ChartSeriesProvider>
</telerik1:RadCartesianChart.SeriesProvider>
</telerik1:RadCartesianChart>
<telerik1:RadLegend Items="{Binding ElementName=Chart, Path=LegendItems}"/>
DailyDatas is an ObservableCollection of DailyData:
public class HourInfo
{
public string HourName { get; set; }
public double? Value { get; set; }
}
public class DailyData
{
public string RoleName { get; set; }
public ObservableCollection<HourInfo> Data { get; set; }
}
What am i doing wrong? Maybe there is another way to make dynamic number of stacked bar series?
Suggest me please asap! Thank you in advance!