2012-01-03 2 views
0

첫 번째 MS 차트를 표시하려고합니다. 단지 간단한 선입니다. 그러나 디버그 (VS2010)를 클릭하면 브라우저에 관계없이 웹 페이지에 누락 된 이미지 아이콘이 표시됩니다. 차트가 MS 차트 샘플에서 복사되었습니다.ASP.Net MS 차트 : 이미지 없음

내 첫 번째 생각은 MS Chart가 제대로 설치되지 않았지만 샘플 환경을 디버깅 할 때 모든 샘플이 잘 작동한다는 것입니다. 이미지를 렌더링하지 못하는 것은 내 테스트 페이지뿐입니다.

나는 어디로 가고 있습니까 ???

<?xml version="1.0"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <appSettings> 
    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /> 
    </appSettings> 

    <system.webServer> 
    <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> 
    <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> 
    <roleManager enabled="true"/> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </assemblies> 
    </compilation> 
    <pages theme="xxx"> 
     <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> 

</configuration> 

여기 페이지 코드입니다 :

다음은 web.config 파일의

<asp:chart id="chart1" runat="server" imagetype="Png" BackColor="WhiteSmoke" BorderWidth="2" BackGradientStyle="TopBottom" BackSecondaryColor="White" Palette="BrightPastel" BorderDashStyle="Solid" BorderColor="26, 59, 105" Height="296px" Width="412px"> 
    <titles> 
      <asp:title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 12pt, style=Bold" ShadowOffset="3" Text="Two series with 20000 points each." ForeColor="26, 59, 105"> 
      </asp:title> 
    </titles> 
    <legends> 
     <asp:legend Enabled="False" IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold"></asp:legend> 
    </legends> 
    <borderskin skinstyle="Emboss"></borderskin> 
    <series> 
     <asp:series Name="Series1" ChartType="FastLine" ShadowColor="Black" BorderColor="180, 26, 59, 105"></asp:series> 
     <asp:series Name="Series2" ChartType="FastLine" ShadowColor="Black" BorderColor="180, 26, 59, 105" Color="224, 64, 10"></asp:series> 
    </series> 
    <chartareas> 
     <asp:chartarea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="Gainsboro" ShadowColor="Transparent" BackGradientStyle="TopBottom"> 
      <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle> 
      <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False"> 
        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" /> 
        <majorgrid linecolor="64, 64, 64, 64" /> 
      </axisy> 
      <axisx linecolor="64, 64, 64, 64" IsLabelAutoFit="False"> 
        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" /> 
        <majorgrid linecolor="64, 64, 64, 64" /> 
      </axisx> 
     </asp:chartarea> 
    </chartareas> 
</asp:chart> 

코드 뒤에 :

using System; 
using System.Collections.Generic; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.DataVisualization.Charting; 
using System.Drawing; 

public partial class reporting : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
     double yValue = 50.0; 
     Random random = new Random(); 
     for (int pointIndex = 0; pointIndex < 20000; pointIndex++) 
     { 
      yValue = yValue + (random.NextDouble() * 10.0 - 5.0); 
      chart1.Series["Series1"].Points.AddY(yValue); 
     } 

     chart1.Series["Series1"].ChartType = SeriesChartType.FastLine; 
    } 
} 

새해 복 많이 받으세요!

답변

1

MS Chart에서 작업 한 지난 번에 웹 설정에서 이미지의 실제 경로를 제공해야했습니다. 그렇지 않으면 나는 깨진 이미지만을 얻을 것이다. 다른 옵션 중에 지속적하지만 C를 만드는 일하지 : \ tempimages 폴더와이 값이 또한

했다 설정, 해당 시스템에 대한 IIS 사용자가 폴더에 쓸 수있는 권한이 있는지 확인하십시오. Windows 탐색기가 아닌 IIS를 통해 권한을 부여하십시오.

1

폴더를 제공하고 IIS 사용자에게 해당 폴더에 대한 액세스 권한을 부여해야합니다. 액세스가 필요한 사용자는 Windows 및 IIS 버전에 따라 다르므로이를 확인해야합니다.