Ejemplo n.º 1
0
        protected void BuildFromCSV(string fileName)
        {
            ChartValuesBefore1.Clear();
            ChartValuesBefore2.Clear();
            ChartValuesAfter1.Clear();
            ChartValuesAfter2.Clear();
            DataTable dt   = CSV_DataTable.ConvertCSVtoDataTable(fileName);
            int       step = 1;

            if (dt.Rows.Count > 100)
            {
                step = dt.Rows.Count / 100;
            }
            try
            {
                for (int i = 1; i < dt.Rows.Count; i = i + step)
                {
                    if (dt.Rows[i][1].ToString() != "")
                    {
                        ChartValuesBefore1.Add(new MeasureModel
                        {
                            ValueX = Convert.ToDouble(dt.Rows[i][1]),
                            ValueY = Convert.ToDouble(dt.Rows[i][0])
                        });

                        ChartValuesBefore2.Add(new MeasureModel
                        {
                            ValueX = Convert.ToDouble(dt.Rows[i][2]),
                            ValueY = Convert.ToDouble(dt.Rows[i][0])
                        });
                    }
                    if (dt.Rows[i][3].ToString() != "")
                    {
                        ChartValuesAfter1.Add(new MeasureModel
                        {
                            ValueX = Convert.ToDouble(dt.Rows[i][3]),
                            ValueY = Convert.ToDouble(dt.Rows[i][0])
                        });

                        ChartValuesAfter2.Add(new MeasureModel
                        {
                            ValueX = Convert.ToDouble(dt.Rows[i][4]),
                            ValueY = Convert.ToDouble(dt.Rows[i][0])
                        });
                    }
                    //MessageBox.Show(i.ToString());
                }
            }

            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Ejemplo n.º 2
0
        private void BuildBack(string v)
        {
            ChartValuesBefore1.Clear();
            ChartValuesBefore2.Clear();
            ChartValuesAfter1.Clear();
            ChartValuesAfter2.Clear();
            int step = ValuesBefore1.Count / 100;

            for (int i = 0; i < ValuesBefore1.Count; i = i + step)
            {
                ChartValuesBefore1.Add(new MeasureModel
                {
                    ValueX = ValuesBefore1[i],
                    ValueY = Convert.ToDouble(i)
                });

                ChartValuesBefore2.Add(new MeasureModel
                {
                    ValueX = ValuesBefore2[i],
                    ValueY = Convert.ToDouble(i)
                });
            }

            for (int i = 0; i < ValuesAfter1.Count; i = i + step)
            {
                ChartValuesAfter1.Add(new MeasureModel
                {
                    ValueX = ValuesAfter1[i],
                    ValueY = Convert.ToDouble(i)
                });

                ChartValuesAfter2.Add(new MeasureModel
                {
                    ValueX = ValuesAfter2[i],
                    ValueY = Convert.ToDouble(i)
                });
            }
        }