我使用折线图来显示人们在日期方面申请的工作数量。
我正在使用折线图来显示它
<asp:Chart ID="chrtDateWise" runat="server" Width="500px">
<Series>
<asp:Series ChartType="Line" Name="Series1">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
代码背后
protected void ShowDateWise()
{
String strSql = string.Empty;
strSql = "SELECT COUNT(ApplicationDate) AS Total, ApplicationDate FROM [Jobs] GROUP BY ApplicationDate, ApplicationDate order by ApplicationDate ";
DataSet ds = DataProvider.Connect_Select(strSql);
DataTable dt = ds.Tables[0];
chrtDateWise.DataSource = dt;
chrtDateWise.Series["Series1"].XValueMember = "ApplicationDate";
chrtDateWise.Series["Series1"].YValueMembers = "Total";
//chrtDateWise.Series["Series1"]["PieLabelStyle"] = "Outside";
chrtDateWise.Series["Series1"].ToolTip = "#VALY";
chrtDateWise.Series["Series1"].Label = "#VALX";
chrtDateWise.DataBind();
}
更新:
我将代码更改为以下
<asp:Chart ID="chrtDateWise" runat="server" Width="600px">
<Series>
<asp:Series ChartType="Line" Name="Series1"> </asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="chrtAreaSupporters">
<AxisY LineColor="White">
<LabelStyle Font="Trebuchet MS, 8.25pt" />
<MajorGrid LineColor="#e6e6e6" />
<MinorGrid Enabled="false" LineColor="#e6e6e6" />
</AxisY>
<AxisX LineColor="White">
<LabelStyle Font="Trebuchet MS, 8.25pt" />
<MajorGrid LineColor="#e6e6e6" />
<MinorGrid Enabled="false" LineColor="#e6e6e6" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
chrtDateWise.Series["Series1"].ChartType = SeriesChartType.Line;
chrtDateWise.Series["Series1"].XValueMember = "Total";
chrtDateWise.Series["Series1"].YValueMembers = "ApplicationDate";
chrtDateWise.Series["Series1"].IsValueShownAsLabel = true;
chrtDateWise.Series["Series1"].BorderWidth = 3;
chrtDateWise.Series["Series1"].Color = System.Drawing.Color.Green;
chrtDateWise.Series["Series1"].YAxisType = AxisType.Secondary;
这也不起作用...
我不确定代码有什么问题,因为查询从表中获取数据,除此之外我还可以显示饼图。
我想我搞砸了图表属性。