Пример #1
0
        void ichart_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var pos = e.Location;
            var results = ichart.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint);
            //foreach (var result in results)
            {
                if (results[0].ChartElementType == ChartElementType.DataPoint)
                {
                    DataPoint point = results[0].Object as DataPoint;
                    var xval = (int)point.XValue;
                    var yval = (int)point.YValues[0];

                    CTextInput2 ct = new CTextInput2();
                    string text = ct.Show("Yield Text");
                    if (MessageBox.Show("Lägga till text för punkt " + xval.ToString() + ":" + yval.ToString() + " ?", "Yield Text", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {

                        OSQLite sql = new OSQLite();
                        GraphDataSet gd = sql.miGetYield2(curdate);
                        string name = "SNO." + gd.SNO[xval].ToString() + "." + gd.Y[xval].ToString();
                        LiteCConfig cfg = new LiteCConfig("Yieldtext.xml");
                        cfg.Add(name, text);
                    }
                }
            }

            yieldtexts.Clear();
            yieldserials.Clear();
            LiteCConfig cfb = new LiteCConfig("Yieldtext.xml");
            yieldtexts = cfb.Read();

            foreach (LiteCParameter x in yieldtexts)
            {
                yieldserials.Add(x.Name.Split('.')[1]);
            }
            FillYield(curdate, curweek, showlab);
        }
Пример #2
0
        public void FillCV(string date, string weeks, CVType cvtype)
        {
            OSQLite sql = new OSQLite();
            LiteCConfig cfg = new LiteCConfig();
            string limit = "";

            //get data
            Collection<GraphDataSet> gd = sql.miGetGraphDataCV(date);
            Collection<Color> colors = new Collection<Color>();
            colors.Add(Color.Red);
            colors.Add(Color.Red);
            colors.Add(Color.Orange);
            colors.Add(Color.Orange);
            colors.Add(Color.Black);
            colors.Add(Color.Black);
            colors.Add(Color.DarkGray);
            colors.Add(Color.DarkGray);
            colors.Add(Color.Blue);
            colors.Add(Color.Blue);
            colors.Add(Color.Yellow);
            colors.Add(Color.Yellow);

            if (cvtype == CVType.Expected) //select if limit series should be expected or absolute limits
                limit = "Exp";
            else
                limit = "Lim";

            string[] names = { "RBC", "RBC_" + limit, "MCV", "MCV_" + limit,
                               "PLT", "PLT_" + limit, "MPV", "MPV_" + limit,
                               "HGB", "HGB_" + limit, "WBC", "WBC_" + limit};
            double[] expected = new double[6] { cfg.ReadD(limit + "_CVRBC"), cfg.ReadD(limit + "_CVMCV"),
                                                cfg.ReadD(limit + "_CVPLT"), cfg.ReadD(limit + "_CVMPV"),
                                                cfg.ReadD(limit + "_CVHGB"), cfg.ReadD(limit + "_CVWBC")};

            //clear all old data in chart
            foreach (Series x in ichart.Series)
                x.Points.Clear();
            ichart.Series.Clear();

            ichart.Titles.Clear();
            ichart.Titles.Add("CV - förväntat gränsvärde " + weeks + " veckor");

            //create new series for all parameters
            int i = 0;
            foreach (string x in names)
            {
                Series series = new Series(x);
                if (i % 2 == 0)//first is parameter, next is expected value
                    series.ChartType = SeriesChartType.Line;
                else
                    series.ChartType = SeriesChartType.Point;
                series.Color = colors[i];
                series.MarkerSize = 2;
                series.MarkerStyle = MarkerStyle.None;
                ichart.Series.Add(series);
                i++;
            }

            //fill all series with data
            for (int k = 0; k < gd[0].Y.Count; k++)
            {
                ichart.Series["RBC"].Points.AddY(gd[0].Y[k]);
                ichart.Series["RBC_" + limit].Points.AddY(expected[0]);

                ichart.Series["MCV"].Points.AddY(gd[1].Y[k]);
                ichart.Series["MCV_" + limit].Points.AddY(expected[1]);

                ichart.Series["PLT"].Points.AddY(gd[2].Y[k]);
                ichart.Series["PLT_" + limit].Points.AddY(expected[2]);

                ichart.Series["MPV"].Points.AddY(gd[3].Y[k]);
                ichart.Series["MPV_" + limit].Points.AddY(expected[3]);

                ichart.Series["HGB"].Points.AddY(gd[4].Y[k]);
                ichart.Series["HGB_" + limit].Points.AddY(expected[4]);

                ichart.Series["WBC"].Points.AddY(gd[5].Y[k]);
                ichart.Series["WBC_" + limit].Points.AddY(expected[5]);
            }
        }
Пример #3
0
        public void FillInstrument(string date, string weeks, CVType cvtype)
        {
            OSQLite sql = new OSQLite();
            LiteCConfig cfg = new LiteCConfig();

            //get data
            Collection<GraphDataSet> gd = new Collection<GraphDataSet>();
            gd.Add(sql.miGetSEQnbrs(date, "M-Series"));
            gd.Add(sql.miGetSEQnbrs(date, "Alfa"));
            gd.Add(sql.miGetSEQnbrs(date, "Exigo"));
            Collection<Color> colors = new Collection<Color>();
            colors.Add(Color.Blue);
            colors.Add(Color.Red);
            colors.Add(Color.Green);
            /*
            colors.Add(Color.Black);
            colors.Add(Color.Black);
            */
            string[] names = { "M-Series", "Alfa", "Exigo"};

            //clear all old data in chart
            foreach (Series x in ichart.Series)
                x.Points.Clear();
            ichart.Series.Clear();

            ichart.Titles.Clear();
            ichart.Titles.Add("Instrument - SEQ/Instrument " + weeks + " veckor");

            //create new series for all parameters
            Series series = new Series(names[0]);
            series.ChartType = SeriesChartType.Point;
            series.Color = colors[0];
            series.MarkerSize = 4;
            series.MarkerStyle = MarkerStyle.None;
            ichart.Series.Add(series);
            series = new Series(names[1]);
            series.ChartType = SeriesChartType.Point;
            series.Color = colors[1];
            series.MarkerSize = 4;
            series.MarkerStyle = MarkerStyle.None;
            ichart.Series.Add(series);
            series = new Series(names[2]);
            series.ChartType = SeriesChartType.Point;
            series.Color = colors[2];
            series.MarkerSize = 4;
            series.MarkerStyle = MarkerStyle.None;
            ichart.Series.Add(series);

            //fill all series with data
            for (int k = 0; k < gd[0].Y.Count; k++)
            {
                ichart.Series["M-Series"].Points.AddY(gd[0].Y[k]);
            }
            for (int k = 0; k < gd[1].Y.Count; k++)
            {
                ichart.Series["Alfa"].Points.AddY(gd[1].Y[k]);
            }
            for (int k = 0; k < gd[2].Y.Count; k++)
            {
                ichart.Series["Exigo"].Points.AddY(gd[2].Y[k]);
            }
        }
Пример #4
0
 public LiteCGraph(Chart chart, Control parent)
 {
     ichart = chart;
     AppPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
     LiteCConfig cfg = new LiteCConfig("Users.xml");
     users = cfg.ReadStringer();
 }
Пример #5
0
 public LiteCGraph(Chart chart, Control parent, Collection<LiteCParameter> yields)
 {
     yieldtexts = yields;
     foreach (LiteCParameter x in yields)
     {
         yieldserials.Add(x.Name.Split('.')[1]);
     }
     ichart = chart;
     AppPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
     LiteCConfig cfg = new LiteCConfig("Users.xml");
     users = cfg.ReadStringer();
     ichart.MouseDoubleClick += ichart_MouseDoubleClick;
 }
Пример #6
0
 private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LiteCConfig cfg = new LiteCConfig();
     cfg.Show();
 }
Пример #7
0
        private void InitializeComboBox()
        {
            LiteCConfig cfg = new LiteCConfig(/*xmlDynamicDirectory +*/ "Instruments.xml");
            InstrumentComboBox.Items.Clear();

            //Using temp List<> for easy sorting
            List<string> temp = new List<string>();
            foreach (LiteCParameter x in cfg.Read()) { temp.Add(x.Value); }
            temp.Sort();
            foreach (string x in temp) { InstrumentComboBox.Items.Add(x); }
        }
Пример #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            InitializeComboBox();
            InstrumentComboBox.SelectedIndex = 0;
            LiteCConfig cfg = new LiteCConfig("Yieldtext.xml");
            gProblem = new LiteCGraph(chProblem, this.tpProblem);
            gComponents = new LiteCGraph(chComponents, this.tpKomponenter);
            gYield = new LiteCGraph(chYield, this.tpYield, cfg.Read());
            gUser = new LiteCGraph(chUser, this.tpUser);
            gCV = new LiteCGraph(chCV, this.tpCV);

            for (int i = 1; i <= 52; i++)
                cbWeeks.Items.Add(i);
            cbWeeks.SelectedIndex = 3;

            int years = DateTime.Now.Year - 2000 - 6;
            for (int i = 1; i <= years; i++)
                cbYears.Items.Add(i);
        }
Пример #9
0
        void dgView_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                LiteCConfig del = new LiteCConfig(xmlfilename);
                String param = dgView.SelectedCells[0].Value.ToString();

                del.DeleteParameter(param);
                dgView.Rows.Clear();
                foreach (LiteCParameter x in del.Read())
                {
                    dgView.Rows.Add();
                    dgView.Rows[dgView.Rows.Count - 2].Cells[0].Value = x.Name;
                    dgView.Rows[dgView.Rows.Count - 2].Cells[1].Value = x.Value;
                }
            }
        }
Пример #10
0
        public LiteCConfigConnection()
        {
            useSqlite = false;
            LiteCConfig cfg = new LiteCConfig();
            if (!cfg.Exist())
                cfg.InitSQLDefaults();

            Database = "temp";
            //Database_Manual = "temp";

            Table_Manual = "TestTransfer";
            //Table_Yieldlabel = "Temp";
        }