asp.net生成图表
关键字:asp .net 生成图表 //生成图表 privatevoidbuildChart() { stringmsg1=""; stringstrArea=""; stringstrbillid=""; stringstrAbsPath=""; stringstrConn=""; stringsql; stringstrName=""; stringstrValue1=""; stringstrValue2=""; string[]seriesNa
关键字:asp
.net生成图表
//生成图表
private void buildChart()
{
string msg1="";
string strArea="";
string strbillid="";
string strAbsPath="";
string strConn="";
string sql;
string strName="";
string strValue1="";
string strValue2="";
string[] seriesNames;
DataSet dataset=new DataSet();
sql=" select top 5 IndexName as 指标名称, AddValue as 值, AddValueThan as 值同比 from TbzData order by billid desc ";
dataset=this.tbzdatactl.GetDataSet(sql);
for(int i=0;i<dataset.Tables[0].Rows.Count;i++)
{
if (i==dataset.Tables[0].Rows.Count-1)
{
strName=strName+dataset.Tables[0].Rows[i]["指标名称"].ToString();
strValue1=strValue1+dataset.Tables[0].Rows[i]["值"].ToString();
strValue2=strValue2+dataset.Tables[0].Rows[i]["值同比"].ToString();
}
else
{
strName=strName+dataset.Tables[0].Rows[i]["指标名称"].ToString()+",";
strValue1=strValue1+dataset.Tables[0].Rows[i]["值"].ToString()+",";
strValue2=strValue2+dataset.Tables[0].Rows[i]["值同比"].ToString()+",";
}
}
strArea=this.tbzdatactl.GetTbdataArea();
strbillid=this.tbzdatactl.GetTbdataBillid();
TbzBmpCtl tbzbmpctl=new TbzBmpCtl();
strAbsPath=tbzbmpctl.GetAbsPath();
strConn=tbzbmpctl.GetConn();
strbillid=strbillid+".gif";
OWC10.ChartSpaceClass chartsc=new OWC10.ChartSpaceClass();
OWC10.DataSourceControlClass dsc=new OWC10.DataSourceControlClass();
chartsc.Charts.Add(0);
chartsc.Charts[0].SeriesCollection.Add(0);
chartsc.HasChartSpaceLegend=false;
chartsc.HasChartSpaceTitle=false;
chartsc.Charts[0].HasLegend=true;
chartsc.Charts[0].HasTitle=true;
chartsc.Charts[0].Type=OWC10.ChartChartTypeEnum.chChartTypeLineMarkers; //折线图
chartsc.Charts[0].Title.Caption="2002年工业增加值";
seriesNames=new string[2];
seriesNames[0] = "累计";
seriesNames[1] = "同比";
chartsc.Charts[0].SetData(OWC10.ChartDimensionsEnum.chDimSeriesNames,(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral,seriesNames[0]);
chartsc.SetData(OWC10.ChartDimensionsEnum.chDimCategories,(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strName);
chartsc.Charts[0].SeriesCollection[0].SetData(OWC10.ChartDimensionsEnum.chDimValues,(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral,strValue1);
原文转自:http://www.ltesting.net