第一范文网 - 专业文章范例文档资料分享平台

文档4:XtraPivotGrid数据分析组件应用

来源:用户分享 时间:2025/7/24 0:39:53 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

namespace DevControlpractice.myForm {

//数据统计分析示例

public partial class Frm_PicotGrid_Qry : XtraForm {

private DataTable _myDT;

private const string sSelectStr =

\其他业务数据分析时需要修改这里的查询语句;

private string sWhere = \ public Frm_PicotGrid_Qry() {

InitializeComponent(); }

//用来进行统计分析的基础业务数据集: public DataTable MyDT {

get { return _myDT; } set { _myDT = value; } }

///

/// 打开数据;

///

///

private void btnOpenData_Click(object sender, EventArgs e) {

LoadData(); }

private void LoadData() {

_myDT = AccessHelper.ExecuteSqlQuery(\sSelectStr + sWhere, null);

bindingSource1.DataSource = _myDT;

string sSqlAnalyse = \项目名称,表名称,字段名称,描述,区域,排序,统计类别 from FieldArea where 项目名称='运输统计'\其他业务数据分析时需要修改这里的查询语句;

pivotGridControl1.DataSource = bindingSource1;

DataTable dtAnalyse = AccessHelper.ExecuteSqlQuery(\sSqlAnalyse, null);//加载统计分析字段设置数据集;

SetPivotUI(dtAnalyse); } //设置PivotGrid控件的字段。

private void SetPivotUI(DataTable DT) {

try {

pivotGridControl1.Fields.Clear();

for (int i = 0; i < DT.Rows.Count; i++) {

if (DT.Rows[i][\区域\ { //新建一个字段对象;

PivotGridField pZZ = new PivotGridField();

pZZ.FieldName = DT.Rows[i][\字段名称\设置字段的 FieldName 属性;

pZZ.Caption = DT.Rows[i][\描述\字段的显示文本属性;

switch (DT.Rows[i][\统计类别\ {

case \汇总和\

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Sum;

pZZ.Caption += \统计类别\

break; }

case \汇总数量\

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Count;

pZZ.Caption += \统计类别\

break; }

case \最大值\

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Max;

pZZ.Caption += \统计类别\

break;

}

case \最小值\

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Min;

pZZ.Caption += \统计类别\

break; }

case \平均值\

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Average;

pZZ.Caption += \统计类别\

pZZ.CellFormat.FormatType DevExpress.Utils.FormatType.Numeric;

pZZ.CellFormat.FormatString \

break; }

case \标准差\

= =

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.StdDev;

pZZ.Caption += \统计类别\

pZZ.CellFormat.FormatType DevExpress.Utils.FormatType.Numeric;

pZZ.CellFormat.FormatString \

break; }

case \总体标准差\

= =

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.StdDevp;

pZZ.Caption += \统计类别\

pZZ.CellFormat.FormatType DevExpress.Utils.FormatType.Numeric;

pZZ.CellFormat.FormatString \

break;

= =

}

case \方差\

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Var;

pZZ.Caption += \统计类别\

pZZ.CellFormat.FormatType DevExpress.Utils.FormatType.Numeric;

pZZ.CellFormat.FormatString \

break; }

case \总体方差\

= =

{

pZZ.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Varp;

pZZ.Caption += \统计类别\

pZZ.CellFormat.FormatType DevExpress.Utils.FormatType.Numeric;

pZZ.CellFormat.FormatString \

break; } default: {

break; } }

switch (DT.Rows[i][\区域\

{

case \行字段\

{

pZZ.Area = PivotArea.RowArea; break; }

case \列字段\

{

pZZ.Area = PivotArea.ColumnArea; break; }

case \数据字段\ {

= =

搜索更多关于: 文档4:XtraPivotGrid数据分析组件应用 的文档
文档4:XtraPivotGrid数据分析组件应用.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c1y0012yx956rgfl162a3_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top