<%@ Page Language="C#" %>

<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <br />
    
        <asp:Chart ID="Chart1" ImageLocation="teste.jpg" ImageStorageMode="UseImageLocation" runat="server" DataSourceID="SqlDataSource1" 
            Palette="Excel" ImageType="Jpeg">
            <Series>
                <asp:Series ChartType="Bar" Name="Series1" XValueMember="CategoryName" 
                    YValueMembers="Total" IsVisibleInLegend="False">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
            <Titles>
                <asp:Title Name="Title1" Text="Exemplo com o controle Chart">
                </asp:Title>                
            </Titles>
            <Annotations>
                <asp:EllipseAnnotation Name="EllipseAnnotation1" Text="Estoque baixo." X="48" Y="27">
                </asp:EllipseAnnotation>
            </Annotations>
        </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:nwind %>" 
            ProviderName="System.Data.SqlClient" 
            SelectCommand="SELECT SUM(Products.UnitsInStock) AS Total, Categories.CategoryName FROM Products INNER JOIN Categories ON Products.CategoryID = Categories.CategoryID GROUP BY Categories.CategoryName, Categories.CategoryID">
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
