【发布时间】:2016-09-16 08:53:12
【问题描述】:
我收到以下错误 - 执行 ChartImg.axd 的子请求时出错。
我正在尝试将数据表绑定到图表
aspx代码:
<asp:Chart ID="Chart1" runat="server" Height="296px" Width="412px" BorderDashStyle="Solid"
BackSecondaryColor="White" BackGradientStyle="TopBottom" BorderWidth="2px" BackColor="211, 223, 240"
BorderColor="#1A3B69">
<Titles>
<asp:Title Text="Title of the Graph comes here" />
</Titles>
<Series>
<asp:Series Name="Series1" BorderColor="180, 26, 59, 105">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent"
BackGradientStyle="TopBottom">
<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, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
代码隐藏:
protected void Page_Load(object sender, EventArgs e)
{
DataTable dtCloned = new DataTable();
DataSet ds2;
ds2 = (DataSet)Session["ds2"];
dtCloned = ds2.Tables[0];
dtCloned.Columns["SSN"].DataType = typeof(string);
Chart1.DataSource = ds2.Tables[0];
Chart1.ChartAreas[0].AxisX.Minimum = 0;
Chart1.ChartAreas[0].AxisX.Maximum = 10;
Chart1.ChartAreas[0].AxisX.Minimum = -5;
Chart1.ChartAreas[0].AxisX.Maximum = 5;
Chart1.Series["Series1"].YValueMembers = "Name";
Chart1.Series["Series1"].XValueMember = "County";
Chart1.DataBind();
}
调试时没有错误。但是一旦完成,我就会收到服务器错误。
提前致谢!
注意:我保留这个问题,因为它对任何其他用户都有建设性。
【问题讨论】:
标签: c# asp.net charts datatable