How to use Chart Control in EP 2009?


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.axdverb=GET,HEADtype=System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35validate=false />


 


Add the just after </system.web>


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


 


Add the just before </pages>


 


<controls>


    <add tagPrefix=”aspnamespace=”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>

Comments (2)

  1. Kannan says:

    Hi,

         Thanks for this post. I did the way which you have explained. But after adding the user control page in an Enterprise Portal am getting the error as

    Unable to load content ChartDiagram. Please contact your system administrator.

    Could you please tell me how to rectify this error? Please…

    Thanks,

    Kannan