码迷,mamicode.com
首页 > Web开发 > 详细

asp.net comp雷达图

时间:2014-08-25 20:39:54      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   文件   for   ar   

bubuko.com,布布扣
<system.web>
    <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    </httpHandlers>
        <pages validateRequest="false">
   <controls>
    <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
     assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   </controls>
  </pages>
</system.web>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true" />
  <handlers>
   <remove name="ChartImageHandler" />
   <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
    path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </handlers>
 </system.webServer>
配置文件

 

bubuko.com,布布扣
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChartFirst.aspx.cs" Inherits="ChartFirst" %>
<%@ 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">
    <table>
      <tr>
    <td>
     <asp:Chart ID="Chart1" runat="server" Width="600px" Height="600px" Visible="false" BackColor="#e7f6ff">
                            <Titles>
                                <asp:Title Text="雷达图">
                                    <Position Y="95" X="50"></Position>
                                </asp:Title>
                            </Titles>
                            <Series>
                                <asp:Series Name="Series1" Color="Red" ChartArea="ChartArea1" ChartType="Radar" IsValueShownAsLabel="false"
                                    BorderWidth="2">
                                </asp:Series>
                            </Series>
                            <ChartAreas>
                                <asp:ChartArea Name="ChartArea1" AlignmentOrientation="Vertical">
                                    <AxisY LineColor="64, 64, 64, 64">
                                        <LabelStyle Font="宋体, 8.25pt" />
                                        <MajorGrid LineColor="silver" />
                                        <MajorTickMark Size="0" />
                                    </AxisY>
                                    <AxisX LineColor="64, 64, 64, 64">
                                        <LabelStyle Font="宋体, 8.25pt" />
                                    </AxisX>
                                    <Position Y="0" Height="100" Width="100" X="0"></Position>
                                </asp:ChartArea>
                            </ChartAreas>
                        </asp:Chart>
                        </td>
                        </tr>
                        </table>
                        <input id="hidSrc" name="hidSrc" type="hidden" runat="server" />
    </form>
</body>
</html>
View Code
bubuko.com,布布扣
 protected void Page_Load(object sender, EventArgs e)
        {
                    if (!Page.IsPostBack)
            {
                GetCharData();
                          }
        }
        /// <summary>
        /// 绑定雷达图
        /// </summary>
        private void GetCharData()
        {
          
            DataTable dt = 获取数据;       
                List<实体类> list = DataTableToList<实体类>.ConvertToList(dt);
                Chart1.Visible = true;
                Chart1.Series["Series1"].Points.DataBind(list, "绑定的字段", "TempScore", "Tooltip=TempScore,Url=LinkUrl");
                Chart1.Series["Series1"]["AreaDrawingStyle"] = "Polygon";
                Chart1.Series["Series1"]["RadarDrawingStyle"] = "Line";
                if (point != 0)
                {
                    Chart1.ChartAreas["ChartArea1"].AxisY.Interval = point / 5;
                    Chart1.ChartAreas["ChartArea1"].AxisY.Maximum = point;
                    Chart1.ChartAreas["ChartArea1"].AxisY.Minimum = 0;
                }
            }
        }
后台代码

 

asp.net comp雷达图

标签:style   blog   http   color   os   io   文件   for   ar   

原文地址:http://www.cnblogs.com/652769324qq/p/3935611.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!