首页 > 代码库 > asp.net comp雷达图

asp.net comp雷达图

<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>
配置文件

 

<%@ 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
 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雷达图