private void RbtnPie_CheckedChanged(object sender, EventArgs e) //
        {
            if (!single_or_all)                                         //绘制单条线路上的数据
            {
                guzhang_bar_chart.Visible = false;
                guzhang_pie_chart.Visible = true;
                double s = 0; //总
                              //List<String> xData = new List<String>();//故障类型就5种
                              //List<Double> yData = new List<Double>();
                double[] sum          = new double[5];
                double[] pro          = new double[5];
                string[] guzhang_Type = new string[] { "断裂", "拉伸", "接头盒进水", "异常", "其他" };
                double[] yData        = new double[5];//故障类型的数量5中

                DBlink db = new DBlink();
                if (db.DBcon())
                {
                    db.Gettype_count(rn, year);//输入线路名得到故障类型和数目
                }
                db.DBclose();

                for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                {
                    sum[i] = double.Parse(guzhang.count[i].ToString()); //得到故障数量
                                                                        //  guzhang_Type[i] = guzhang.guzhang_type[i].ToString();//
                                                                        //textBox1.Text= guzhang.guzhang_type[i].ToString();
                                                                        //guzhang_Type[i] =guzhangtype_comboBox1.Items[i].ToString();//此处不能赋值
                }
                guzhang.guzhang_type.CopyTo(guzhang_Type);
                for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                {
                    s += sum[i];
                }
                for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                {
                    pro[i] = sum[i] * (1 / s);

                    yData[i] = double.Parse(pro[i].ToString("0.00"));
                }
                guzhang_pie_chart.Series[0].Points.DataBindXY(guzhang_Type, yData);
                guzhang_pie_chart.Series[0]["PieLabelStyle"] = "Outside"; //将文字移到外侧
                guzhang_pie_chart.Series[0]["PieLineColor"]  = "Black";   //绘制黑色的连线。
            }
            if (single_or_all)                                            //绘制全部线路
            {
                guzhang_bar_chart.Visible = false;
                guzhang_pie_chart.Visible = true;
                double s = 0; //总
                              //List<String> xData = new List<String>();//故障类型就5种
                              //List<Double> yData = new List<Double>();
                double[] sum          = new double[5];
                double[] pro          = new double[5];
                string[] guzhang_Type = new string[5];
                double[] yData        = new double[5];//故障类型的数量5中

                DBlink db = new DBlink();
                if (db.DBcon())
                {
                    db.Gettype_count(year);//输入线路名得到故障类型和数目
                }
                db.DBclose();

                for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                {
                    sum[i] = double.Parse(guzhang.count[i].ToString()); //得到故障数量
                                                                        //  guzhang_Type[i] = guzhang.guzhang_type[i].ToString();//
                                                                        //textBox1.Text= guzhang.guzhang_type[i].ToString();
                                                                        //guzhang_Type[i] =guzhangtype_comboBox1.Items[i].ToString();//此处不能赋值
                }
                guzhang.guzhang_type.CopyTo(guzhang_Type);              //将 ArrayList中guzhang.guzhang_type复制到数组guzhang_Type

                for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                {
                    s += sum[i];
                }
                for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                {
                    pro[i] = sum[i] * (1 / s);

                    yData[i] = double.Parse(pro[i].ToString("0.00"));
                }
                guzhang_pie_chart.Series[0].Points.DataBindXY(guzhang_Type, yData);
            }
        }//用饼状图实现年份故障类型分析
        private void DataAnalysis_Click(object sender, EventArgs e)
        {
            if (!single_or_all)      //如果选择某条线路
            {
                if (rbtnBar.Checked) //当选择柱状图时
                {
                    DataTable dt1 = default(DataTable);
                    dt1 = Create_DataTable(rn); //返回值给dt1//调用
                                                //设置图表数据源
                    guzhang_bar_chart.DataSource = dt1;
                    //绑定数据
                    guzhang_bar_chart.DataBind();
                }

                if (rbtnPie.Checked)
                {
                    double s = 0; //总
                                  //List<String> xData = new List<String>();//故障类型就5种
                                  //List<Double> yData = new List<Double>();
                    double[] sum          = new double[5];
                    double[] pro          = new double[5];
                    string[] guzhang_Type = new string[5];
                    double[] yData        = new double[5];//故障类型的数量5中

                    DBlink db = new DBlink();
                    if (db.DBcon())
                    {
                        db.Gettype_count(rn, year);//输入线路名得到故障类型和数目
                    }
                    db.DBclose();

                    for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                    {
                        sum[i] = double.Parse(guzhang.count[i].ToString()); //得到故障数量
                                                                            //  guzhang_Type[i] = guzhang.guzhang_type[i].ToString();//
                                                                            //textBox1.Text= guzhang.guzhang_type[i].ToString();
                                                                            //guzhang_Type[i] =guzhangtype_comboBox1.Items[i].ToString();//此处不能赋值
                    }
                    guzhang.guzhang_type.CopyTo(guzhang_Type);
                    for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                    {
                        s += sum[i];
                    }
                    for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                    {
                        pro[i]   = sum[i] * (1 / s);
                        yData[i] = double.Parse(pro[i].ToString("0.00"));
                    }
                    guzhang_pie_chart.Series[0].Points.DataBindXY(guzhang_Type, yData);
                }
            }

            if (single_or_all)       //如果选择所有线路
            {
                if (rbtnBar.Checked) //当选择柱状图时
                {
                    DataTable dt1 = default(DataTable);
                    dt1 = Create_DataTable(); //返回值给dt2//调用
                                              //设置图表数据源
                    guzhang_bar_chart.DataSource = dt1;
                    //绑定数据
                    guzhang_bar_chart.DataBind();
                }

                if (rbtnPie.Checked)
                {
                    double s = 0; //总
                                  //List<String> xData = new List<String>();//故障类型就5种
                                  //List<Double> yData = new List<Double>();
                    double[] sum          = new double[5];
                    double[] pro          = new double[5];
                    string[] guzhang_Type = new string[5];
                    double[] yData        = new double[5];//故障类型的数量5中

                    DBlink db = new DBlink();
                    if (db.DBcon())
                    {
                        db.Gettype_count(year);//输入线路名得到故障类型和数目
                    }
                    db.DBclose();

                    for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                    {
                        sum[i] = double.Parse(guzhang.count[i].ToString()); //得到故障数量
                                                                            //  guzhang_Type[i] = guzhang.guzhang_type[i].ToString();//
                                                                            //textBox1.Text= guzhang.guzhang_type[i].ToString();
                                                                            //guzhang_Type[i] =guzhangtype_comboBox1.Items[i].ToString();//此处不能赋值
                    }
                    guzhang.guzhang_type.CopyTo(guzhang_Type);              //将 ArrayList中guzhang.guzhang_type复制到数组guzhang_Type

                    for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                    {
                        s += sum[i];
                    }
                    for (int i = 0; i < guzhang.guzhang_type.Count; i++)
                    {
                        double tmp = 1 / s;
                        pro[i]   = sum[i] * tmp;
                        yData[i] = double.Parse(pro[i].ToString("0.00"));
                    }
                    guzhang_pie_chart.Series[0].Points.DataBindXY(guzhang_Type, yData);
                }
            }
        }