Originally based on this post: http://ko.infragistics.com/community/forums/p/64311/478866.aspx
We would like to use this range of colors:
<x:Array x:Key="SeriesBrushes" Type="Brush"> <SolidColorBrush Color="#FFBA131A" Opacity=".75" /> <SolidColorBrush Color="#FFEF413D" Opacity=".75" /> <SolidColorBrush Color="#FFF58220" Opacity=".75" /> <SolidColorBrush Color="#FFFAA61A" Opacity=".75" /> <SolidColorBrush Color="#FFFFF200" Opacity=".75" /> <SolidColorBrush Color="#FFCFFC8B" Opacity=".75" /> <SolidColorBrush Color="#FF6CCF32" Opacity=".75" /> <SolidColorBrush Color="#FF00A289" Opacity=".75" /> <SolidColorBrush Color="#FF00B6BD" Opacity=".75" /> <SolidColorBrush Color="#FF0066B3" Opacity=".75" /> <SolidColorBrush Color="#FF389FDA" Opacity=".75" /> <SolidColorBrush Color="#FF9ADAFF" Opacity=".75" /> <SolidColorBrush Color="#FF7766B5" Opacity=".75" /> <SolidColorBrush Color="#FF95086F" Opacity=".75" /> <SolidColorBrush Color="#FF5C2D91" Opacity=".75" /> <SolidColorBrush Color="#FFAA55A1" Opacity=".75" /> <SolidColorBrush Color="#FFF49AC1" Opacity=".75" /> <SolidColorBrush Color="#FFFFFFFF" Opacity=".75" /> <SolidColorBrush Color="#FF898989" Opacity=".75" /> <SolidColorBrush Color="#FF464646" Opacity=".75" /> <SolidColorBrush Color="#FF9E520E" Opacity=".75" /> <SolidColorBrush Color="#FFB38550" Opacity=".75" /> </x:Array>
<x:Array x:Key="SeriesBrushes"
Type="Brush">
<SolidColorBrush Color="#FFBA131A"
Opacity=".75" />
<SolidColorBrush Color="#FFEF413D"
<SolidColorBrush Color="#FFF58220"
<SolidColorBrush Color="#FFFAA61A"
<SolidColorBrush Color="#FFFFF200"
<SolidColorBrush Color="#FFCFFC8B"
<SolidColorBrush Color="#FF6CCF32"
<SolidColorBrush Color="#FF00A289"
<SolidColorBrush Color="#FF00B6BD"
<SolidColorBrush Color="#FF0066B3"
<SolidColorBrush Color="#FF389FDA"
<SolidColorBrush Color="#FF9ADAFF"
<SolidColorBrush Color="#FF7766B5"
<SolidColorBrush Color="#FF95086F"
<SolidColorBrush Color="#FF5C2D91"
<SolidColorBrush Color="#FFAA55A1"
<SolidColorBrush Color="#FFF49AC1"
<SolidColorBrush Color="#FFFFFFFF"
<SolidColorBrush Color="#FF898989"
<SolidColorBrush Color="#FF464646"
<SolidColorBrush Color="#FF9E520E"
<SolidColorBrush Color="#FFB38550"
</x:Array>
Hi Raaj_001,
This will depend on how you are creating the StackedBarSeries. If you are auto generating the fragment series, then you can use the SeriesCreated event in order to set the Brush of the fragment based on logic. If you are manually creating the StackedFragmentSeries then you can just iterate through the StackedBarSeries.Series collection and set the brushes that way.
I have a StackedBarSeries for which I am generating data. How do i change the color of every data point inside the chart?
I want to loop through the fragments and provide a custom color based on complex logic
How can this be achieved?
That would also do the trick. Completely slipped my mind. Thought you were looking for a more manual approach. Glad you found that.
Thanks Rob.
Found the solution was looking for:
Snippet:
<infragistics:BrushCollection x:Key="BrushCollectionMultiColor"> <SolidColorBrush Color="#FFBA131A" Opacity=".90" />
.
</infragistics:BrushCollection>
<ig:XamDataChart x:Name="StackedAreaChart" Title="Stacked Area Chart" Subtitle="Titan Data" Legend="{Binding ElementName=StackedAreaLegend}" Brushes="{StaticResource BrushCollectionMultiColor}">
Thanks,
Michael
Hi Michael,
You will want to use the SeriesCreated event on the StackedColumnSeries since you are autogenerating the fragment series. The generated StackedFragmentSeries will be passed as the sender to the event so you can set whatever properties you need to on this object, including the brush it uses.