ASP.NET Chart Control

 

(1)    Install the components

Chart Controls for .NET Framework

Chart Controls Add-on for Visual Studio 2008

 

(2)   MODIFY WEB.CONFIG

Add the below as the child node to  <HttpHandlers> section

<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />

 

Add the just after </system.web>

<appSettings>
    <
add
key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</
appSettings>

 

Add the just before </pages>

 

<controls>

    <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

   </controls>

 

 

(3)   Create c:\TempImageFiles folder and give read access to the app pool

 

 

Here is a sample markup for user control using Chart control ( replace the highlighted ones with your datasource  control and the field or display field name)

<asp:Chart ID="Chart1" runat="server" DataMember="CustTable_Current"

    DataSourceID="AxDataSource1">

    <Legends>

        <asp:Legend Alignment="Center" Docking="Bottom" LegendStyle="Row"

            Name="Legend1">

        </asp:Legend>

    </Legends>

    <series>

        <asp:Series Legend="Legend1" Name="Open Sales Orders"

            YValueMembers="openSalesOrders**" YValuesPerPoint="4">

        </asp:Series>

        <asp:Series ChartArea="ChartArea1" Legend="Legend1" Name="Total Sales Orders"

            YValueMembers="NoSalesOrders**" YValuesPerPoint="4">

        </asp:Series>

    </series>

    <chartareas>

        <asp:ChartArea Name="ChartArea1">

            <Area3DStyle Enable3D="True" />

        </asp:ChartArea>

    </chartareas>

</asp:Chart>