求基于C#c1chart做的统计图报表系统
发布网友
发布时间:2022-05-03 11:42
我来回答
共2个回答
热心网友
时间:2022-06-19 15:15
导入执行isql就可以
using System;using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Office.Interop.OWC;
ChartSpaceClass oChartSpace = new ChartSpaceClass();
GetSelectId();
if(T_ID.Text=="")
{
rs.Alert("请选择分析表!",this);
this.Image1.Visible = false;
return;
}
string S_Sql ="SELECT d.id,d.YYMM,d.bm+' '+x.XMMC as xm, "+this.O_Type.SelectedItem.Value+"(m.df) as ["+this.O_Type.SelectedItem.Value+"] "
+" FROM P_MYDD D,P_MYDM M,P_XMZL x where m.id=d.id and d.bm=x.xmbm and "
+" d.id in("+T_ID.Text+") "
+" group by d.YYMM,d.bm+' '+x.XMMC,d.id";
DataSet ds=rs.getrs( S_Sql);
int i = ds.Tables[0].DefaultView.Count;
string[]s1 = new string[i];
string[]s2 = new string[i];
for(int p=0;p<i;p++)
{
s1[p] = ds.Tables[0].Rows[p]["YYMM"].ToString().Trim()+"-"+ds.Tables[0].Rows[p]["xm"].ToString().Trim();
}
if(this.O_Type.SelectedItem.Value == "avg")
{
for(int p=0;p<i;p++)
{
s2[p] = ds.Tables[0].Rows[p]["avg"].ToString().Trim();
}
}
else if(this.O_Type.SelectedItem.Value == "sum")
{
for(int p=0;p<i;p++)
{
s2[p] = ds.Tables[0].Rows[p]["sum"].ToString().Trim();
}
}
oChartSpace.Charts.Add(0);
if(this.O_Gif.SelectedItem.Value =="1")
{
oChartSpace.Charts[0].Type=ChartChartTypeEnum.chChartTypeColumnClustered ;
}
else
{
oChartSpace.Charts[0].Type=ChartChartTypeEnum.chChartTypePie ;
}
oChartSpace.Charts[0].HasLegend = true; //系列
oChartSpace.Charts[0].HasTitle = true;
oChartSpace.Charts[0].Title.Caption="满意度分布图";
oChartSpace.Charts[0].SeriesCollection.Add(0);
if(this.O_Type.SelectedItem.Value == "avg")
{
oChartSpace.Charts[0].SeriesCollection[0].Caption="平均分";
oChartSpace.Charts[0].Title.Caption="平均分对比图";
}
else
{
oChartSpace.Charts[0].SeriesCollection[0].Caption="总分";
oChartSpace.Charts[0].Title.Caption="总分对比图";
}
oChartSpace.Charts[0].SeriesCollection[0].Line.Color="red";
oChartSpace.Charts[0].SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),String.Join("\t", s1));
oChartSpace.Charts[0].SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),String.Join("\t", s2) );
string filename = System.DateTime.Now.Ticks.ToString() +".gif";
string strFullPathAndName=Server.MapPath( filename );
oChartSpace.ExportPicture( strFullPathAndName, "gif", 800, 600);
string fp = Request.FilePath.Substring(0,Request.FilePath.LastIndexOf ('/'));
Image1.ImageUrl=@"http://" + Request.Url.Host + fp +@"/" + filename;
Image1.Visible =true;
rs.RemoveFiles(Server.MapPath("."),".gif");
热心网友
时间:2022-06-19 15:16
楼主可以试一下FineReport报表软件,支持SQL2005的数据源和数据回填,可以自主生成各种形态的图表如柱状图之类,并且支持与Excel互相导入导出。