我在使用vs2010中的chart做图标,但是显示出来的X轴标签不完整?
3个回答
展开全部
请参考如下代码:(VB2010)
With Chart1
.ChartAreas(0).AxisX.Maximum = 300
.ChartAreas(0).AxisY.Maximum = 100
.ChartAreas(0).AxisY.Minimum = 0
End With
这个是用来设置坐标标轴属性的.估计是你数据集数量太大了
With Chart1
.ChartAreas(0).AxisX.Maximum = 300
.ChartAreas(0).AxisY.Maximum = 100
.ChartAreas(0).AxisY.Minimum = 0
End With
这个是用来设置坐标标轴属性的.估计是你数据集数量太大了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没有什么好的详细教程,给你简单点的,
简单示例,
<asp:Chart ID="Chart1" runat="server" Height="400px" Width="500px">
<Series>
<asp:Series Name="Series1" ChartType="Column" ChartArea="ChartArea1">
</asp:Series>
<asp:Series Name="Series2" ChartType="Column" ChartArea="ChartArea1">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = default(DataTable);
dt = CreateDataTable();
//设置图表的数据源
Chart1.DataSource = dt;
//设置图表Y轴对应项
Chart1.Series[0].YValueMembers = "Volume1";
Chart1.Series[1].YValueMembers = "Volume2";
//设置图表X轴对应项
Chart1.Series[0].XValueMember = "Date";
//绑定数据
Chart1.DataBind();
}
private DataTable CreateDataTable()
{
//Create a DataTable as the data source of the Chart control
DataTable dt = new DataTable();
//Add three columns to the DataTable
dt.Columns.Add("Date");
dt.Columns.Add("Volume1");
dt.Columns.Add("Volume2");
DataRow dr;
//Add rows to the table which contains some random data for demonstration
dr = dt.NewRow();
dr["Date"] = "Jan";
dr["Volume1"] = 3731;
dr["Volume2"] = 4101;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Feb";
dr["Volume1"] = 6024;
dr["Volume2"] = 4324;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Mar";
dr["Volume1"] = 4935;
dr["Volume2"] = 2935;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Apr";
dr["Volume1"] = 4466;
dr["Volume2"] = 5644;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "May";
dr["Volume1"] = 5117;
dr["Volume2"] = 5671;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Jun";
dr["Volume1"] = 3546;
dr["Volume2"] = 4646;
dt.Rows.Add(dr);
return dt;
}
简单示例,
<asp:Chart ID="Chart1" runat="server" Height="400px" Width="500px">
<Series>
<asp:Series Name="Series1" ChartType="Column" ChartArea="ChartArea1">
</asp:Series>
<asp:Series Name="Series2" ChartType="Column" ChartArea="ChartArea1">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = default(DataTable);
dt = CreateDataTable();
//设置图表的数据源
Chart1.DataSource = dt;
//设置图表Y轴对应项
Chart1.Series[0].YValueMembers = "Volume1";
Chart1.Series[1].YValueMembers = "Volume2";
//设置图表X轴对应项
Chart1.Series[0].XValueMember = "Date";
//绑定数据
Chart1.DataBind();
}
private DataTable CreateDataTable()
{
//Create a DataTable as the data source of the Chart control
DataTable dt = new DataTable();
//Add three columns to the DataTable
dt.Columns.Add("Date");
dt.Columns.Add("Volume1");
dt.Columns.Add("Volume2");
DataRow dr;
//Add rows to the table which contains some random data for demonstration
dr = dt.NewRow();
dr["Date"] = "Jan";
dr["Volume1"] = 3731;
dr["Volume2"] = 4101;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Feb";
dr["Volume1"] = 6024;
dr["Volume2"] = 4324;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Mar";
dr["Volume1"] = 4935;
dr["Volume2"] = 2935;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Apr";
dr["Volume1"] = 4466;
dr["Volume2"] = 5644;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "May";
dr["Volume1"] = 5117;
dr["Volume2"] = 5671;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "Jun";
dr["Volume1"] = 3546;
dr["Volume2"] = 4646;
dt.Rows.Add(dr);
return dt;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个要分析就要看你的代码了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询