• Asp.Net4.0/VS2010新变化(6):内置的图表控件


    .net4.0以前,要想在网页上画个饼图,那还真不是个轻松的活儿,得有点技术含量,比如:可以用System.Drawing下的那些东东,再或者用Silverlight/Flash或第三方控件

    现在asp.net 4.0已经把它做成控件了

    直接拖到页面就完事了,下面是示例代码:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApp.Default"
        EnableViewState="false" %>
    
    <%@ 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">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>图表控件</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:Chart ID="Chart1" runat="server">
            <Series>
                <asp:Series Name="Series1" ChartType="Pie">
                    <Points>
                        <asp:DataPoint AxisLabel="IE 6.0" YValues="60.0" />
                        <asp:DataPoint AxisLabel="IE 7.0" YValues="27.1" />
                        <asp:DataPoint AxisLabel="Others" YValues="12.9" />                                    
                    </Points>
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                    <Area3DStyle Enable3D="true" />
                    <Position Auto="true" />
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>
        </form>
    </body>
    </html>
    

    运行效果如下:

    作者:菩提树下的杨过
    出处:http://yjmyzz.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    程序猿之歌
    How to solve the problem : &quot;You have been logged on with a temporary profile&quot;
    LeetCode Jump Game
    hdu 3496 Watch The Movie
    matlab矩阵内存预分配
    【Windows socket+IP+UDP+TCP】网络基础
    <html>
    行为类模式(十):模板方法(Template Method)
    行为类模式(九):策略(Strategy)
    行为类模式(八):状态(State)
  • 原文地址:https://www.cnblogs.com/yjmyzz/p/1679281.html
Copyright © 2020-2023  润新知