Changing SmartChart entity colors using the SmartChartRectangleRender event.
ASPX Code

<%@ Page language="c#" MasterPageFile="~/SampleCode/SamplesMasterPage.master" Inherits="SmartWebControls.SampleCode.SmartChartRectangleRenderEvent" CodeFile="SmartChartRectangleRenderEvent.aspx.cs" %>
<%@ Register TagPrefix="swc" Namespace="SmartWebControls" Assembly="SmartWebControls.SmartChart" %>
<asp:Content ID="content" runat="server" ContentPlaceHolderID="cphMain">
        <div id="divTitle">
            Changing SmartChart entity colors using the SmartChartRectangleRender event.</div>
            <swc:SmartChartPro id="SmartChart1" runat="server" DrawShadows="True" DataTitleFields="name,desc,contact"
                DataNodeName="person" DataKeyField="id" DataFields="name,title,contact" MaxTextLength="25"
                BoxColor="LightGray" BoxGradient="True" BoxTextColor="Navy" ChartDepth="4" SmartChartDirectory="~/ImageFolder"
                AllowDrillDown="True" Font-Bold="true" ShadowOffset="6" title="SmartChartRectangleRender Event Demo"
                TitleColor="MidnightBlue" MaxChildrenPerLevelGroup="8" ImageHeight="70" ImageWidth="90" DrawBorder="False"
                Width="750px" Height="456px" OutputType="Image" CenterAll="False" TextOnly="False" 
                CleanupInterval="60" HasChildrenImagePath="~/SampleCode/SmartChartPro/Images/down.gif" 
                HasParentImagePath="~/SampleCode/SmartChartPro/Images/up.gif" 
                DrillDownType="SmartChartImage"></swc:SmartChartPro>
</asp:Content>

C# Code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Drawing.Drawing2D;

namespace SmartWebControls.SampleCode {
    /// <summary>
    /// Summary description for OrgsTest.
    /// </summary>
    public partial class SmartChartRectangleRenderEvent : System.Web.UI.Page {
    
        protected void Page_Load(object sender, System.EventArgs e) {
                string xmlPath = Server.MapPath("~/SampleCode/SmartChartPro/XML/OrgChart.xml");
                XmlDocument doc = new XmlDocument();
                doc.Load(xmlPath);
                //Hook up event to event handler
                SmartChart1.SmartChartRectangleRendering += new EventHandler<SmartChartEventArgs>(SmartChart1_SmartChartRectangleRendering);
                SmartChart1.SmartChartRectangleRendered += new EventHandler<SmartChartEventArgs>(SmartChart1_SmartChartRectangleRendered);
                SmartChart1.DataSource = doc;
                SmartChart1.DataBind();
        }

        //Demonstrate how to prevent certain SmartChart entities from being drawn out
        private void SmartChart1_SmartChartRectangleRendering(object sender, SmartWebControls.SmartChartEventArgs e) {
//            string title = e.Item.DataItem["title"].ToString().ToLower();
//            if (title.IndexOf("manager") != -1) { //Found a node that has what we want
//                e.Cancel = true;
//            }
        }

        private void SmartChart1_SmartChartRectangleRendered(object sender, SmartWebControls.SmartChartEventArgs e) {
            if (e.Item.DataItem != null) {
                SmartWebControls.SmartChartItem item = e.Item;
                Color boxColor = Color.Empty;
                bool drawBorder = true;
                //Grab appropriate title key from DataKeyField values and use it to access the text value
                string title = item.DataItem["title"].ToString().ToLower();
                if (title.IndexOf("mgr") != -1) { //Found a node that has what we want
                    boxColor = Color.Coral;
                }
                if (title.IndexOf("developer") != -1) { //Found a node that has what we want
                    boxColor = Color.Goldenrod;
                }
                if (title.IndexOf("admin") != -1)
                {
                    boxColor = Color.White;
                    drawBorder = false;
                }
                //Draw appropriate box colors
                if (boxColor != Color.Empty) {
                    Graphics g = e.Item.Graphics;
                    RectangleF rec = new RectangleF(item.X,item.Y,(float)item.Width.Value,(float)item.Height.Value);
                    Pen boxPen = new Pen(Color.Black,(float)SmartChart1.BoxBorderWidth.Value);
                    if (drawBorder) g.DrawRectangle(boxPen,rec.X,rec.Y,rec.Width,rec.Height);
                    if (SmartChart1.BoxGradient) { //Do gradient brush
                        LinearGradientBrush brush = new LinearGradientBrush(rec,boxColor, 
                            Color.White,90.0f, true );
                        (brush as LinearGradientBrush).SetSigmaBellShape(.5f, .7f);
                        g.FillRectangle(brush,rec);
                    } else {
                        SolidBrush solidBrush = new SolidBrush(boxColor);
                        g.FillRectangle(solidBrush,rec);
                    }
                }
            }
        }

    }
}