vs2008 开发3D 报表-MSChart学习帮助-开发日志(一)-带附件下载

vs2008 开发3D 报表-MSChart学习帮助-开发日志(一)-带附件下载_第1张图片

我X 这是我第二次写这篇文章了,刚才写了半天IE浏览器给关闭了,我X  不过我又狠下心来,为大家再服务一会 :)

首先看到这个报表的界面会不会感觉很爽,没错,这就是用MSchart 的图形报表组件,完全免费的 开发的

如果你不看这篇文章,可能会碰很多钉子,写这个 就是为了让大家更快,更顺利的去使用这个.net FrameWork 3.5新组件的功能

先发表了,继续修改,免得又出现关闭浏览器问题...

 

 

继续  首先你要安装Vs2008这我就不说了,.net FrameWork 3.5这也是要有的,

然后下载MSChart的和4个补丁文件,在这里我都给大家提供好了,在我的资源里就有下载,5分哦,不过下载完评论下就不扣分了。

 

然后依次安装

dotnetfx35setup.exe

MSChart_VisualStudioAddOn.exe

MSChartLP_chs.exe

MSChart.exe

这几个文件,然后OK

启动VS2008准备写程序

 

创建一个Web 项目

然后在左边的工具卡里添加 .net FrameWork组件  Chart  这里添加Web UI 的Chart组件如果时WinForm的话就添加WinForm的

 

然后在数据的选项卡里,把Chart的控件拖到界面上

 

HTML代码如下

 

 

  1. <asp:chart id="Chart1" runat="server" Height="296px" Width="412px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" Palette="BrightPastel" imagetype="Png" BorderDashStyle="Solid" BackSecondaryColor="White" BackGradientStyle="TopBottom" BorderWidth="2" backcolor="#D3DFF0" BorderColor="26, 59, 105">
  2.                         <legends>
  3.                             <asp:Legend IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold"></asp:Legend>
  4.                         </legends>
  5.                         <borderskin skinstyle="Emboss"></borderskin>
  6.                         <series>
  7.                             <asp:Series Name="Column" BorderColor="180, 26, 59, 105">
  8.                                 <points>
  9.                                     <asp:DataPoint YValues="45" />
  10.                                     <asp:DataPoint YValues="34" />
  11.                                     <asp:DataPoint YValues="67" />
  12.                                     <asp:DataPoint YValues="31" />
  13.                                     <asp:DataPoint YValues="27" />
  14.                                     <asp:DataPoint YValues="87" />
  15.                                     <asp:DataPoint YValues="45" />
  16.                                     <asp:DataPoint YValues="32" />
  17.                                 </points>
  18.                             </asp:Series>
  19.                         </series>
  20.                         <chartareas>
  21.                             <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom">
  22.                                 <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>
  23.                                 <axisy linecolor="64, 64, 64, 64">
  24.                                     <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
  25.                                     <majorgrid linecolor="64, 64, 64, 64" />
  26.                                 </axisy>
  27.                                 <axisx linecolor="64, 64, 64, 64">
  28.                                     <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
  29.                                     <majorgrid linecolor="64, 64, 64, 64" />
  30.                                 </axisx>
  31.                             </asp:ChartArea>
  32.                         </chartareas>
  33.                     </asp:chart>

 

 

后台代码如下

  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Xml.Linq;
  13. using System.Web.UI.DataVisualization.Charting;
  14. namespace WebApplication2
  15. {
  16.     public partial class _Default : System.Web.UI.Page
  17.     {
  18.         protected void Page_Load(object sender, EventArgs e)
  19.         {
  20.             // Create new data series and set it's visual attributes
  21.             Series series = new Series("Spline");
  22.             series.ChartType = SeriesChartType.Spline;
  23.             series.BorderWidth = 3;
  24.             series.ShadowOffset = 2;
  25.             // Populate new series with data
  26.             series.Points.AddY(67);
  27.             series.Points.AddY(57);
  28.             series.Points.AddY(83);
  29.             series.Points.AddY(23);
  30.             series.Points.AddY(70);
  31.             series.Points.AddY(60);
  32.             series.Points.AddY(90);
  33.             series.Points.AddY(20);
  34.             // Add series into the chart's series collection
  35.             Chart1.Series.Add(series);
  36.         }
  37.     }
  38. }

ok ,你可以按F5运行了

 

是不是报错了?

哈哈,当然要报错 还要配置Web.Config 开个玩笑:)

Web.Config还要配置如下

  1. <appSettings>
  2.         <add key="ChartImageHandler" value="Storage=file;Timeout=20;Url=~/tempImages/;"/>
  3.     </appSettings>
  4.     

 

 

  1. <httpHandlers>
  2.             <remove verb="*" path="*.asmx"/>
  3.             <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  4.             <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  5.             <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
  6.             <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
  7.         </httpHandlers>
  1. <handlers>
  2.             <remove name="ChartImageHandler"/>
  3.             <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  4.         </handlers>

ok,再次运行,你会看到你喜欢看到的东西了 ,哈哈~~~感谢大家关注~~~Gavin Luo的博客

你可能感兴趣的:(.net,server,浏览器,Path,报表,WinForm)