2012-01-03 13 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で作業していましたが、Web設定の画像の物理パスを指定する必要がありました。それ以外の場合、私は壊れた画像を取得します。他のオプションは一貫して動作しませんでしたが、c:\ tempimagesフォルダを作成してこの値を設定しました。

また、そのコンピュータのIISユーザーがフォルダに書き込む権限を持っていることを確認してください。 WindowsエクスプローラではなくIISを通じてアクセス許可を与えます。

1

フォルダを指定する必要があります。また、IISユーザーにそのフォルダにアクセスする権限を与える必要があります。アクセスが必要なユーザーは、WindowsとIISのバージョンによって異なりますので、チェックする必要があります。

関連する問題