Binding Data to the SmartChart Control Using the XmlDataSource
The SmartChart control can be bound to an XmlDataSource control as shown in this example. The example also shows how custom images can be used for SmartChart items and backgrounds. Click an SmartChart item to drill-down into the chart more.

County Organization Chart
-
Lin Thomas
CIO




-
-
Patti Bell
Admin Assistant
Paul Johnson
Deputy CIO





-
-
-
Greg Jamison
Web Mgr
Jack Doe
PC Mgr
Troy Wallace
Exchange
ASPX Code

<%@ Page Language="C#" MasterPageFile="~/SampleCode/SamplesMasterPage.master" AutoEventWireup="true" CodeFile="UsingXmlDataSource.aspx.cs" Inherits="SampleCode_DataSourceControls_UsingXmlDataSource" %>
<%@ Register TagPrefix="swc" Namespace="SmartWebControls" Assembly="SmartWebControls.SmartChart" %>
<asp:Content ID="content" runat="server" ContentPlaceHolderID="cphMain">
    <style type="text/css">
        .TitleStyle
        {
            font-family: Arial;
            font-size: 14pt;
            background-color: Navy;
            color: White;
            margin-bottom: 8px;
            vertical-align: middle;
            height:30px;
            border-bottom:2px solid #cccccc;
        }
    </style>
    <div id="divTitle">Binding Data to the SmartChart Control Using the XmlDataSource</div>
    <div id="divInstructions">
        The SmartChart control can be bound to an XmlDataSource control as shown in this example.  The example also shows how custom
        images can be used for SmartChart items and backgrounds.  Click an SmartChart item to drill-down into the chart more.
    </div>
    <br />
            <swc:SmartChartPro id="WebSmartChart1" DataSourceID="xmlDS" runat="server" 
                Width="733px" Height="300px" DrawShadows="True"
                DataTitleFields="name,title,duties" DataNodeName="person"
                DataKeyField="id" DataFields="name,title" BoxColor="Transparent" 
                BoxGradient="True" BoxTextColor="White" TitleCssClass="TitleStyle"
                ChartDepth="3" AllowDrillDown="True" FontStyle="Bold"
                ShadowOffset="5" title="County Organization Chart" MaxChildrenPerLevelGroup="8"
                ImageHeight="50" ImageWidth="50" DrawBorder="true"
                BackgroundImage="../Images/glasstwistOpaque.jpg" 
                BoxBackgroundImage="../Images/blueSwirlBG.jpg" OutputType="Html" 
                ShadowColor="LightGray"></swc:SmartChartPro>
            <asp:XmlDataSource ID="xmlDS" runat="server" DataFile="~/SampleCode/SmartChartPro/XML/OrgChart.xml" />
</asp:Content>

C# Code:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class SampleCode_DataSourceControls_UsingXmlDataSource : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}