}//更改值描述文本的默认值

        private void btDraw2_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(cmbxTableNames4.Text))
            {
                MessageBox.Show("未加载任何数据表!");
                return;
            }
            if (String.IsNullOrEmpty(cmbxXField3.Text) || String.IsNullOrEmpty(cmbxY1Field3.Text) || String.IsNullOrEmpty(cmbxY2Field3.Text) || String.IsNullOrEmpty(cmbxY3Field3.Text) || String.IsNullOrEmpty(cmbxY3Field3.Text))
            {
                MessageBox.Show("自变量和因变量不能为空");
                return;
            }
            DataTable      sourceDt    = dataGridView4.DataSource as DataTable;
            FieldValueType y1FieldType = DataTableImp.GetFieldType(sourceDt, cmbxY1Field3.Text);
            FieldValueType y2FieldType = DataTableImp.GetFieldType(sourceDt, cmbxY2Field3.Text);
            FieldValueType y3FieldType = DataTableImp.GetFieldType(sourceDt, cmbxY3Field3.Text);
            FieldValueType y4FieldType = DataTableImp.GetFieldType(sourceDt, cmbxY4Field3.Text);

            if (y1FieldType == FieldValueType.非值文本 || y2FieldType == FieldValueType.非值文本 || y3FieldType == FieldValueType.非值文本 || y4FieldType == FieldValueType.非值文本)
            {
                MessageBox.Show("因变量字段不可为非数值字段!");
                return;
            }
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames31 = new List <string>()
            {
                cmbxXField3.Text, cmbxY1Field3.Text
            };
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames32 = new List <string>()
            {
                cmbxXField3.Text, cmbxY2Field3.Text
            };
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames33 = new List <string>()
            {
                cmbxXField3.Text, cmbxY3Field3.Text
            };
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames34 = new List <string>()
            {
                cmbxXField3.Text, cmbxY4Field3.Text
            };
            int       startRowNum3 = Convert.ToInt32(txbxStartRowNum4.Text) - 1; //DataTable的行号从0开始
            int       endRowNum3   = Convert.ToInt32(txbxEndRowNum4.Text) - 1;
            DataTable tempDt       = DataTableImp.GetTableByFieldNamesAndRowNumRange3(sourceDt, fieldNames31, fieldNames32, fieldNames33, fieldNames34, startRowNum3, endRowNum3);
            //再进行因变量字段值的值类型转换
            DataTable           resultDt = DataTableImp.ConvertFieldToType3(tempDt, cmbxY1Field3.Text, cmbxY2Field3.Text, cmbxY3Field3.Text, cmbxY4Field3.Text, y1FieldType, y2FieldType, y3FieldType, y4FieldType);
            WaterTatalFormChart waterFrm = new WaterTatalFormChart(resultDt, cmbxXField3.Text, cmbxY1Field3.Text, cmbxY2Field3.Text, cmbxY3Field3.Text, cmbxY4Field3.Text, cmbxValueDescribe31.Text, cmbxValueDescribe32.Text, cmbxValueDescribe33.Text, cmbxValueDescribe34.Text);

            waterFrm.ShowDialog();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 生成统计图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChart_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(cmbxTableNames.Text))
            {
                MessageBox.Show("未加载任何数据表!");
                return;
            }
            if (String.IsNullOrEmpty(cmbxXField.Text) || String.IsNullOrEmpty(cmbxYField.Text))
            {
                MessageBox.Show("自变量和因变量不能为空");
                return;
            }

            //判断因变量字段是否是值字段,或者是否能强制转换成值
            DataTable      sourceDt   = dataGridView1.DataSource as DataTable;
            FieldValueType yFieldType = DataTableImp.GetFieldType(sourceDt, cmbxYField.Text);
            FieldValueType zFieldType = DataTableImp.GetFieldType(sourceDt, cmbxZField.Text);

            if (yFieldType == FieldValueType.非值文本)
            {
                MessageBox.Show("因变量字段不可为非数值字段!");
                return;
            }
            if (zFieldType == FieldValueType.非值文本)
            {
                MessageBox.Show("因变量字段不可为非数值字段!");
                return;
            }

            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames = new List <string>()
            {
                cmbxXField.Text, cmbxYField.Text
            };
            List <string> fieldNames1 = new List <string>()
            {
                cmbxXField.Text, cmbxZField.Text
            };
            int startRowNum = Convert.ToInt32(txbxStartRowNum.Text) - 1; //DataTable的行号从0开始
            int endRowNum   = Convert.ToInt32(txbxEndRowNum.Text) - 1;
            //先进行行列筛选
            DataTable tempDt = DataTableImp.GetTableByFieldNamesAndRowNumRange(sourceDt, fieldNames, fieldNames1, startRowNum, endRowNum);
            //再进行因变量字段值的值类型转换
            DataTable resultDt = DataTableImp.ConvertFieldToType(tempDt, cmbxYField.Text, cmbxZField.Text, yFieldType, zFieldType);
            ChartForm chartFrm = new ChartForm(resultDt, cmbxXField.Text, cmbxYField.Text, cmbxZField.Text, cmbxValueDescribe.Text, cmbxValueDescribe1.Text);

            chartFrm.ShowDialog();
        }
Exemplo n.º 3
0
        private void btDraw_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(cmbxTableNames3.Text))
            {
                MessageBox.Show("未加载任何数据表!");
                return;
            }
            if (String.IsNullOrEmpty(cmbxXField2.Text) || String.IsNullOrEmpty(cmbxY1Field2.Text) || String.IsNullOrEmpty(cmbxY2Field2.Text) || String.IsNullOrEmpty(cmbxY3Field2.Text))
            {
                MessageBox.Show("自变量和因变量不能为空");
                return;
            }

            //判断因变量字段是否是值字段,或者是否能强制转换成值
            DataTable      sourceDt    = dataGridView3.DataSource as DataTable;
            FieldValueType yFieldType1 = DataTableImp.GetFieldType(sourceDt, cmbxY1Field2.Text);
            FieldValueType yFieldType2 = DataTableImp.GetFieldType(sourceDt, cmbxY2Field2.Text);
            FieldValueType yFieldType3 = DataTableImp.GetFieldType(sourceDt, cmbxY3Field2.Text);

            if (yFieldType1 == FieldValueType.非值文本 || yFieldType2 == FieldValueType.非值文本 || yFieldType3 == FieldValueType.非值文本)
            {
                MessageBox.Show("因变量字段不可为非数值字段!");
                return;
            }
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames1 = new List <string>()
            {
                cmbxXField2.Text, cmbxY1Field2.Text
            };
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames2 = new List <string>()
            {
                cmbxXField2.Text, cmbxY2Field2.Text
            };
            //根据选择的自变量因变量字段,及行范围,新生成表
            List <string> fieldNames3 = new List <string>()
            {
                cmbxXField2.Text, cmbxY3Field2.Text
            };
            int       startRowNum = Convert.ToInt32(txbxStartRowNum2.Text) - 1; //DataTable的行号从0开始
            int       endRowNum   = Convert.ToInt32(txbxEndRowNum2.Text) - 1;
            DataTable tempDt      = DataTableImp.GetTableByFieldNamesAndRowNumRange2(sourceDt, fieldNames1, fieldNames2, fieldNames3, startRowNum, endRowNum);
            //再进行因变量字段值的值类型转换
            DataTable      resultDt  = DataTableImp.ConvertFieldToType2(tempDt, cmbxY1Field2.Text, cmbxY2Field2.Text, cmbxY3Field2.Text, yFieldType1, yFieldType2, yFieldType3);
            TotalFormChart totalFrom = new TotalFormChart(resultDt, cmbxXField2.Text, cmbxY1Field2.Text, cmbxY2Field2.Text, cmbxY3Field2.Text, cmbxValueDescribe21.Text, cmbxValueDescribe22.Text, cmbxValueDescribe23.Text);

            totalFrom.ShowDialog();
        }