哪位好心人,帮帮忙,救急啊!先谢谢啦
我们做的网站中需要对客户调查结果进行图表显示,图表做成,数据库
问题补充:
只要是用ASP.NET的OWC做的叠加的柱状图,每个柱上显示调查的结果——满意,一般,不满意 -
我做里个饼图,代码如下:
public void Chart()
{
string strSeriesName = "图例4";
//string ConnectString = "Data Source=.;Initial Catalog=GCGL;Integrated Security=True";
string Sql = "select IsCustom,Num=Count(*) from tb_Relation where IsCustom=0 group by IsCustom union select IsCustom,Num=Count(*) from tb_Relation where IsCustom=1 group by IsCustom";
DataSet ds = DBHelper.ExecuteDataSet(CommandType.Text, Sql);
//是否成为客户状态
string[] IsCustom = new string[12];
//存放数据
string[] Num = new string[12];
//为数组赋值
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Num[i] = ds.Tables[0].Rows[i][1].ToString();
string IsCustoms = ds.Tables[0].Rows[i][0].ToString();
if (IsCustoms == "1")
{
IsCustom[i] = "客户";
}
else
{
IsCustom[i] = "联系人";
}
}
//为x轴指定特定字符串,以便显示数据
string strXdata = String.Empty;
foreach (string strData in IsCustom)
{
strXdata += strData + "\t";
}
string strYdata = String.Empty;
//为y轴指定特定的字符串,以便与x轴相对应
foreach (string strValue in Num)
{
strYdata += strValue + "\t";
}
//创建ChartSpace对象来放置图表
ChartSpace laySpace = new ChartSpaceClass();
//在ChartSpace对象中添加图表
ChChart InsertChart = laySpace.Charts.Add(0);
InsertChart.Type = ChartChartTypeEnum.chChartTypePie3D;//饼图
//指定图表是否需要图例标注
InsertChart.HasLegend = true;
InsertChart.HasTitle = true;//为图表添加标题
InsertChart.Title.Caption = "客户与联系人统计图表";//标题名称
InsertChart.Title.Font.Size = 15;
InsertChart.Title.Font.Color = "black";
//添加一