We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply GradientColorMapping to SfTreeMap

Platform: WPF |
Control: SfTreeMap
Tags: sftreemap

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: http://www.syncfusion.com/downloads/support/directtrac/general/ze/TreemapGradient-1305433188

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile