コード例 #1
0
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        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
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        public void FillUser(string date, string weeks)
        {
            OSQLite sql = new OSQLite();
            string[] names = { "", "Instrument", "Samp/Instr" };
            ColumnGraphSet data1 = new ColumnGraphSet();
            data1.Add(users);

            for (int i = 0; i < data1.Data[0].Items.Count; i++)
            {
                data1.Add(sql.miGetTestedInstruments(data1.Data[0].Items[i].ToString(), date).ToString());
            }
            data1.Merge();
            for (int i = 0; i < data1.Data[0].Items.Count; i++)
            {
                if (data1.Data[1].Items[i].ToString() == "0")
                {
                    data1.Remove(i);
                    i--;
                }
            }

            string[] xValues = data1.GetNames();
            double[] yValues = data1.GetInstruments();

            SetChart("Produktion - " + weeks + " veckor", xValues, yValues, 100);
        }
コード例 #3
0
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        //Statistics
        public void FillYield(string date, string weeks, bool showlabel)
        {
            curdate = date;
            curweek = weeks;
            showlab = showlabel;

            OSQLite sql = new OSQLite();
            GraphDataSet gd = sql.miGetYield2(date);

            ichart.Series[0].Points.Clear();
            ichart.Series[0].MarkerColor = Color.DarkBlue;
            ichart.Series[1].Points.Clear();
            ichart.Series[1].MarkerColor = Color.Orange;
            ichart.ChartAreas[0].AxisX.Minimum = 0;
            ichart.Titles.Clear();
            ichart.Titles.Add("Yield - " + weeks + " veckor");

            string cursno = "";
            int i = 0;
            foreach (double y in gd.Y)
            {
                ichart.Series[0].Points.AddXY(i, y);
                if (showlabel)
                {
                    cursno = gd.SNO[i].ToString();
                    if (yieldserials.Contains(cursno) && yieldtexts[yieldserials.IndexOf(cursno)].Name.Split('.')[2] == y.ToString())
                    {
                        ichart.Series[0].Points[ichart.Series[0].Points.Count - 1].IsValueShownAsLabel = true;
                        ichart.Series[0].Points[ichart.Series[0].Points.Count - 1].Label = yieldtexts[yieldserials.IndexOf(cursno)].Value;
                    }
                }
                ichart.Series[1].Points.AddXY(i, 75);
                i++;
            }
        }
コード例 #4
0
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        public void FillProblem(string date, string weeks,string instrument)
        {
            OSQLite sql = new OSQLite();

            int count = 0;
            int val = 0;

            CStringer ids = sql.miGetIDs(date);
            string noprobs = sql.miGetNoProblem(date);
            double noproblems = double.Parse(noprobs);
            int yield = (int)((noproblems / (double)ids.Items.Count) * 100.0);

            val = sql.miGetIssues("CompChange", date,instrument);
            count += val;
            double component = val;

            val = sql.miGetIssues("BlanksTomany", date,instrument);
            count += val;
            double dirty = val;

            val = sql.miGetReCalConf("Repro", date);
            count += val;
            //count = 40;
            double repro = val;

            val = sql.miGetReCalConf("ReCalib", date);
            count += val;
            double recalib = val;

            val = sql.miGetReCalConf("Confirm", date);
            count += val;
            double confirm = val;

            string[] xValues = { "Frisläpta Instrument", "Inga Problem", "Yield(%)", "Komponent", "Smutsig", "Repro", "Omkalibrering", "Konf/Nivåer", "Antal Fel" };
            double[] yValues = { ids.Items.Count, noproblems, yield, component, dirty, repro, recalib, confirm, count };

            SetChart("Felutfall - " + weeks + " veckor", xValues, yValues, 20);
        }
コード例 #5
0
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        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]);
            }
        }
コード例 #6
0
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        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]);
            }
        }
コード例 #7
0
ファイル: LiteCGraph.cs プロジェクト: Raxo94/QCView
        public void FillComponents(string date, string weeks)
        {
            OSQLite sql = new OSQLite();
            CStringer comps = sql.miComponents(date);
            int dummy = 1;
            List<string> sortedcomps = new List<string>();
            foreach (string x in comps.Items)
            {
                if (!int.TryParse(x, out dummy))
                {
                    if (!x.Contains("Ej Inkluderad")) //x is new db version with component name info
                    {
                        string[] temp = x.Split(':');
                        if (temp.Length == 1) //only one component is replaced
                        {
                            string[] tp = x.Split('-');

                            if (tp.Length >= 3)
                                sortedcomps.Add(tp[1].Trim() + "\r\n" + tp[2]);
                            else
                                sortedcomps.Add(tp[0]);
                        }
                        else //more than one component is replaced
                        {
                            foreach (string y in temp)
                            {
                                string[] tp = y.Split('-');

                                if (tp.Length >= 3)
                                    sortedcomps.Add(tp[1].Trim() + "\r\n" + tp[2]);
                                else
                                    sortedcomps.Add(tp[0]);
                            }
                        }
                    }
                    else //x is not yet implemented in component list
                    {
                        sortedcomps.Add("Okänd");
                    }
                }
                else
                {
                    //x is old version with number of replaced components
                    for (int i = 0; i < dummy; i++)
                        sortedcomps.Add("Okänd");
                }

            }
            sortedcomps.Sort();
            ComponentList cp = new ComponentList();
            foreach(string x in sortedcomps)
            {
                //Get list with distinct names and count
                cp.Add(x);
            }

            int idx = 0;
            string[] xValues = new string[cp.Items.Count];
            double[] yValues = new double[cp.Items.Count];
            foreach (string x in cp.Items)
            {
                xValues[idx] = x;
                yValues[idx] = cp.Count[idx];
                idx++;
            }

            SetChart("Felutfall - komponenter - " + weeks + " veckor", xValues, yValues, 100);
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: Raxo94/QCView
 private void cbYears_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbYears.SelectedIndex != -1)
     {
         selectionweek = false;
         cbWeeks.SelectedIndex = -1;
         int iweeks = int.Parse(cbYears.SelectedItem.ToString()) * 52;
         string date = GetYearWeek(iweeks);
         string instrument = InstrumentComboBox.SelectedItem.ToString();
         if (tcSelector.SelectedTab.Name == "tpProblem")
         {
             //iProblem = true;
             gProblem.FillProblem(date, iweeks.ToString(), instrument);
         }
         if (tcSelector.SelectedTab.Name == "tpKomponenter")
         {
             //iProblem = true;
             gComponents.FillComponents(date, iweeks.ToString());
         }
         if (tcSelector.SelectedTab.Name == "tpUser")
         {
             //iUser = true;
             gUser.FillUser(date, iweeks.ToString());
         }
         if (tcSelector.SelectedTab.Name == "tpCV")
         {
             //iCV = true;
             if (cbCVLimits.Checked)
                 gCV.FillCV(date, iweeks.ToString(), CVType.Absolute);
             else
                 gCV.FillCV(date, iweeks.ToString(), CVType.Expected);
         }
         if (tcSelector.SelectedTab.Name == "tpYield")
         {
             //iYield = true;
             OSQLite sql = new OSQLite();
             gYield.FillYield(date, iweeks.ToString(), cbShowlabels.Checked);
         }
     }
 }