This question is locked. New answers and comments are not allowed.
Hi,
I'm having issues with getting correct bar colouring when using LegendDisplayMode="DataPointLabel" in a stacked bar chart. The Chart I have consists of two stacked bar series and a line series. Each bar in the series represents something different so i'm using DataPointLabel to give them different colours - This is fine problems occur with the second stacked bar - I'd like the second bar to have a different palette (in this case similar to the first palette but lighter) and the line series to have a single colour.
I've got my code so far below, the problem is that the two stacked bars use the same palette so it looks like a single bar and I have little control over the colour of the line series. What I'd like to do is set individual palettes for each series - is this possible?
code is as follows;
With the palette set as a BrushCollection of 10 SolidColorBrush's - Hopefully this is enough info to show you what I'm looking to do, if not I can provide screenshots, etc
Thanks
I'm having issues with getting correct bar colouring when using LegendDisplayMode="DataPointLabel" in a stacked bar chart. The Chart I have consists of two stacked bar series and a line series. Each bar in the series represents something different so i'm using DataPointLabel to give them different colours - This is fine problems occur with the second stacked bar - I'd like the second bar to have a different palette (in this case similar to the first palette but lighter) and the line series to have a single colour.
I've got my code so far below, the problem is that the two stacked bars use the same palette so it looks like a single bar and I have little control over the colour of the line series. What I'd like to do is set individual palettes for each series - is this possible?
code is as follows;
<
telerik:RadChart
x:Name
=
"ModelYearPCPVChart"
ItemsSource
=
"{Binding ChartData}"
PaletteBrushes
=
"{StaticResource ModelYearStackedPalette}"
>
<
telerik:RadChart.DefaultView
>
<
telerik:ChartDefaultView
>
<
telerik:ChartDefaultView.ChartTitle
>
<
telerik:ChartTitle
x:Name
=
"ModelYearPCPVChartTitle"
Content
=
"{Binding Source={StaticResource Strings}, Path=ModelYearPCPVChartTitle}"
/>
</
telerik:ChartDefaultView.ChartTitle
>
<
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartLegend
x:Name
=
"ModelYearPCPVChartLegend"
HorizontalContentAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Visibility
=
"Collapsed"
/>
</
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartDefaultView.ChartArea
>
<
telerik:ChartArea
SmartLabelsEnabled
=
"True"
LegendName
=
"ModelYearPCPVChartLegend"
>
<!--<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"ItemClick"
>
<
i:InvokeCommandAction
Command
=
"{Binding ChartItemClickedCommand}"
CommandParameter
=
"{Binding ElementName=ModelYearPCPVChart, Path=DefaultView.ChartArea.SelectedItems[0].DataItem}"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>-->
<
telerik:ChartArea.AxisY
>
<
telerik:AxisY
MinorTickPointMultiplier
=
"5"
ExtendDirection
=
"None"
MinorTicksVisibility
=
"Visible"
DefaultLabelFormat
=
"{StaticResource PCPVLabelFormat}"
Title
=
"{Binding Source={StaticResource Strings}, Path=PCPVAxisLabel}"
/>
</
telerik:ChartArea.AxisY
>
<
telerik:ChartArea.AxisX
>
<
telerik:AxisX
DefaultLabelFormat
=
"{StaticResource ModelYearLabelFormat}"
Title
=
"{Binding Source={StaticResource Strings}, Path=ModelYears}"
/>
</
telerik:ChartArea.AxisX
>
<
telerik:ChartArea.AdditionalYAxes
>
<
telerik:AxisY
AxisName
=
"SalesAxis"
Title
=
"{Binding Source={StaticResource Strings}, Path=VINsSoldAxisLabel}"
/>
</
telerik:ChartArea.AdditionalYAxes
>
</
telerik:ChartArea
>
</
telerik:ChartDefaultView.ChartArea
>
</
telerik:ChartDefaultView
>
</
telerik:RadChart.DefaultView
>
<
telerik:RadChart.SeriesMappings
>
<
telerik:SeriesMapping
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:StackedBarSeriesDefinition
StackGroupName
=
"PCPV"
ShowItemToolTips
=
"True"
ItemToolTipFormat
=
"{StaticResource ModelYearPCPVPCPVTooltip}"
ItemLabelFormat
=
"{StaticResource PCPVLabelFormat}"
LegendDisplayMode
=
"DataPointLabel"
>
<
telerik:StackedBarSeriesDefinition.InteractivitySettings
>
<
telerik:InteractivitySettings
SelectionMode
=
"Single"
SelectionScope
=
"Item"
/>
</
telerik:StackedBarSeriesDefinition.InteractivitySettings
>
</
telerik:StackedBarSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
FieldName
=
"CCPV"
DataPointMember
=
"YValue"
/>
<
telerik:ItemMapping
FieldName
=
"ModelYear"
DataPointMember
=
"XCategory"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
<
telerik:SeriesMapping
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:StackedBarSeriesDefinition
StackGroupName
=
"PCPV"
ShowItemToolTips
=
"True"
ItemToolTipFormat
=
"{StaticResource ModelYearPCPVCCPVTooltip}"
ItemLabelFormat
=
"{StaticResource CCPVLabelFormat}"
LegendDisplayMode
=
"DataPointLabel"
>
<
telerik:StackedBarSeriesDefinition.InteractivitySettings
>
<
telerik:InteractivitySettings
SelectionMode
=
"Single"
SelectionScope
=
"Item"
/>
</
telerik:StackedBarSeriesDefinition.InteractivitySettings
>
</
telerik:StackedBarSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
FieldName
=
"RemainingPCPV"
DataPointMember
=
"YValue"
/>
<
telerik:ItemMapping
FieldName
=
"ModelYear"
DataPointMember
=
"XCategory"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
<
telerik:SeriesMapping
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:LineSeriesDefinition
AxisName
=
"SalesAxis"
ShowItemToolTips
=
"True"
ItemToolTipFormat
=
"{StaticResource ModelYearPCPVNumberOfVINsTooltip}"
>
<
telerik:LineSeriesDefinition.InteractivitySettings
>
<
telerik:InteractivitySettings
SelectionMode
=
"Single"
SelectionScope
=
"Item"
/>
</
telerik:LineSeriesDefinition.InteractivitySettings
>
</
telerik:LineSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
FieldName
=
"NumberOfVINs"
DataPointMember
=
"YValue"
/>
<
telerik:ItemMapping
FieldName
=
"ModelYear"
DataPointMember
=
"XCategory"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
</
telerik:RadChart.SeriesMappings
>
<
telerik:RadChart.SortDescriptors
>
<
telerik:ChartSortDescriptor
Member
=
"ModelYear"
SortDirection
=
"Descending"
/>
</
telerik:RadChart.SortDescriptors
>
<
telerik:RadContextMenu.ContextMenu
>
<
usercontrols:ExportContextMenu
/>
</
telerik:RadContextMenu.ContextMenu
>
</
telerik:RadChart
>
With the palette set as a BrushCollection of 10 SolidColorBrush's - Hopefully this is enough info to show you what I'm looking to do, if not I can provide screenshots, etc
Thanks