Articles in this section
Category / Section

How to apply GradientColorMapping to SfTreeMap

1 min read

By using the leaf color mapping, you can apply colors to tree map. To apply gradient colors, specify the gradient ranges as demonstrated in the following code sample.

<syncfusion:SfTreeMap.LeafColorMapping>                   
                    <syncfusion:RangeBrushColorMapping>
                        <syncfusion:RangeBrushColorMapping.Brushes>
                            <syncfusion:RangeBrush  From="0" To="1" LegendLabel="1 % Growth">
                                <syncfusion:RangeBrush.GradientColors>
                                    <Color A="255" R="241" G="236" B="216"/>
                                    <Color A="255" R="222" G="226" B="185"/>
                                </syncfusion:RangeBrush.GradientColors>
                            </syncfusion:RangeBrush>
                            <syncfusion:RangeBrush From="0" To="2" LegendLabel="2 % Growth">
                                <syncfusion:RangeBrush.GradientColors>
                                    <Color A="255" R="222" G="226" B="185"/>
                                    <Color A="255" R="203" G="216" B="154"/>
                                </syncfusion:RangeBrush.GradientColors>
                            </syncfusion:RangeBrush>
                            <syncfusion:RangeBrush Color="#FFAF51" From="0" To="3" LegendLabel="3 % Growth">
                                <syncfusion:RangeBrush.GradientColors>
                                    <Color A="255" R="203" G="216" B="154"/>
                                    <Color A="255" R="184" G="206" B="123"/>
                                </syncfusion:RangeBrush.GradientColors>
                            </syncfusion:RangeBrush>
                            <syncfusion:RangeBrush Color="#F3D240" From="0" To="4" LegendLabel="4 % Growth">
                                <syncfusion:RangeBrush.GradientColors>
                                    <Color A="255" R="184" G="206" B="123"/>
                                    <Color A="255" R="156" G="191" B="78"/>
                                </syncfusion:RangeBrush.GradientColors>
                            </syncfusion:RangeBrush>
                        </syncfusion:RangeBrushColorMapping.Brushes>
                    </syncfusion:RangeBrushColorMapping>
                </syncfusion:SfTreeMap.LeafColorMapping>
 

 

Output Image

Apply gradient ColorMapping to SfTreeMap control

Sample for applying gradient colors to tree map: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TreemapGradient-1305433188

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied