首页 新闻 搜索 专区 学院

关于MSCHART问题 Image is not found 求帮助!

0
悬赏园豆:100 [待解决问题] 解决于 2011-03-26 17:44

最近公司的项目用到了MSCHART   小弟对这个控件是第一次使用   遇见了如下问题   求帮助

ERRORMESSAGE:

The image is not found.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: The image is not found.] 
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.ProcessSavedChartImage(HttpContext context) +414 
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +75 
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 

下面是我的代码:

HTML:

<asp:Chart ID="Chart1" runat="server" Width="400px" Height="250px" ImageType="Png" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)#NOGUIDPARAM">
<Series>
<asp:Series Name="Series1" LabelFormat="{N0}">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>
<axisy linecolor="64, 64, 64, 64">
<labelstyle font="Trebuchet MS, 8.25pt" />
<majorgrid linecolor="64, 64, 64, 64" />
</axisy>
<axisx linecolor="64, 64, 64, 64">
<labelstyle font="Trebuchet MS, 8.25pt" />
<majorgrid linecolor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>

 

C#:

其中MODEL.P05这些变量都为INT型

private void Page_Load()
{
Chart1.Titles.Add(
"单位:人民币");
Chart1.RenderType
= RenderType.ImageTag;

Chart1.Titles[
0].Alignment = ContentAlignment.TopRight;
Chart1.Series[
"Series1"].ChartType = SeriesChartType.Line;
Series chart1Series
= Chart1.Series["Series1"];
chart1Series.MarkerStyle
= MarkerStyle.Circle;
chart1Series.IsValueShownAsLabel
= true;
chart1Series[
"ShowMarkerLines"] = "True";
chart1Series.Points.AddXY(
0.05, Model.P05);
chart1Series.Points.AddXY(
0.25, Model.P25);
chart1Series.Points.AddXY(
0.50, Model.P50);
chart1Series.Points.AddXY(
0.75, Model.P75);
chart1Series.Points.AddXY(
0.95, Model.P95);

ChartArea area
= Chart1.ChartAreas[0];
Axis axisX
= area.AxisX;
axisX.MajorTickMark.Enabled
= false;
axisX.MajorGrid.Enabled
= false;
CustomLabel elem
= axisX.CustomLabels.Add(-0.05, 0.15, "5%");
elem.GridTicks
= GridTickTypes.TickMark;
elem
= axisX.CustomLabels.Add(0.15, 0.35, "25%", 0, LabelMarkStyle.Box);
elem.GridTicks
= GridTickTypes.TickMark;
elem
= axisX.CustomLabels.Add(0.40, 0.60, "50%");
elem.GridTicks
= GridTickTypes.TickMark;
elem
= axisX.CustomLabels.Add(0.65, 0.85, "75%");
elem.GridTicks
= GridTickTypes.TickMark;
elem
= axisX.CustomLabels.Add(0.85, 1.05, "95%");
elem.GridTicks
= GridTickTypes.TickMark;

axisX.LineColor
= Color.Silver;
axisX.Maximum
= 1;
axisX.Minimum
= 0;

area.BackColor
= Color.Gainsboro;
Axis axisY
= area.AxisY;
axisY.LineColor
= Color.Silver;
axisY.MajorGrid.LineColor
= Color.White;
axisY.LabelStyle.Format
= "{N0}";
axisY.MajorTickMark.Enabled
= false;

if (Model.YourSalary <= 0) return;

chart1Series
= new Series("My Position") {ChartType = SeriesChartType.Line};
Chart1.Series.Add(chart1Series);
chart1Series.Points.AddXY(Model.YourPercent
/ 100.0, Model.YourSalary);
chart1Series.Points[
0].Label = string.Format("{0:0,0}\n({1}%)", (int)Model.YourSalary, Model.YourPercent);
chart1Series.Points[
0].LabelForeColor = Color.Goldenrod;

chart1Series.MarkerStyle
= MarkerStyle.Star5;
chart1Series.MarkerSize
= 13;
chart1Series.MarkerColor
= Model.BelongsToLine ? Color.Goldenrod : Color.Gray;
}

 

以下为我的WEB.CONFIG配置

 

<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~\TempImages\;deleteAfterServicing=false; webDevServerUseConfigSettings=false" />
</appsettings>


<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31df876ad464e35"/>
</controls>
</pages>

<httpHandlers>
<add path="ChartImg.axd" verb="POST,GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>

<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=3.5.0.0, Culture=neutral, PublicKeyToken=31df876ad464e35"/>
</handlers>
</system.webServer>

 

按到网上搜到的修改方法都改过了   但还是显示不出来图片   访问图片地址就会报  Image is not found   错误   求知道的大虾帮我解答一下   小弟在这里拜谢了!

问题补充: 靠这是什么情况刚才还是好的怎么就变成这样了
袜子脏了的主页 袜子脏了 | 初学一级 | 园豆:52
提问于:2011-03-11 17:44
< >
分享
所有回答(2)
0

这种情况估计是ChartImageHandler处理的目录文件不存在或者权限问题(TempImages给network service授权),可以看看windows事件日志有什么提示

2012 | 园豆:21007 (高人七级) | 2011-03-12 22:47
0
<httpHandlers>
<remove path="*.asmx" verb="*"/>
<add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<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"/>
</httpHandlers>

试试

寿 | 园豆:205 (菜鸟二级) | 2011-03-21 17:22
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册