private void BindDataToChart() { GetChartData(); chart2.Series["Coverage"].Points.Clear(); chart2.Titles[0].Text = ""; DataView dv = new DataView(_dataSet.Tables[0]); //coverage int totalsum = 0; List <InstrumentPerTA> listofITA = new List <InstrumentPerTA>(); bool isinthelist = false; foreach (DataRow dr in _dataSet.Tables[0].Rows) { foreach (TestingArea ta in DataRepository.GetAllTestingArea()) { if (ta.AreaName == Convert.ToString(dr["AreaName"])) { foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea == ta) { isinthelist = true; break; } else { isinthelist = false; break; } } if (!isinthelist) { InstrumentPerTA IPTA = new InstrumentPerTA(); IPTA.TestingArea = ta; listofITA.Add(IPTA); } foreach (InstrumentPerTA ia in listofITA) { if (ia.TestingArea.AreaName == Convert.ToString(dr["AreaName"])) { ia.Quantity = ia.Quantity + Convert.ToInt32(dr["Qty"]); } } } //totalsum = totalsum + Convert.ToInt32(dr["Qty"]); } } foreach (DataRow dr in _dataSet.Tables[0].Rows) { foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea.AreaName == Convert.ToString(dr["AreaName"])) { totalsum = a.Quantity; break; } } decimal coverage = 0; if (totalsum != 0) { coverage = Convert.ToDecimal(dr["Qty"]) / totalsum; } chart2.Series["Coverage"].Points.AddXY(dr["InstrumentName"].ToString(), coverage); chart2.Series["Coverage"].LegendText = "Instrument Distribution"; } chart2.ChartAreas[0].AxisX.LabelStyle.IsEndLabelVisible = true; chart2.ChartAreas[0].AxisX.IsLabelAutoFit = true; chart2.ChartAreas[0].AxisX.LabelStyle.Angle = 90; chart2.ChartAreas[0].AxisX.LabelStyle.Interval = 1; // chart2.ChartAreas[0].AxisX.LabelStyle.IsStaggered = true; chart2.ChartAreas[0].AxisX.LabelStyle.TruncatedLabels = true; //end coverage chart2.Titles[0].Text = _title; chart2.Invalidate(); }
private void BindDataToChart() { GetChartData(); chart2.Series["Contribution"].Points.Clear(); chart2.Series["Utilization"].Points.Clear(); chart2.Series["Coverage"].Points.Clear(); chart2.Titles[0].Text = ""; if (_finfo.DatausageEnum == DataUsageEnum.DATA_USAGE1 || _finfo.DatausageEnum == DataUsageEnum.DATA_USAGE2) { if (_finfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC) { DataView dv = new DataView(_dataSet.Tables[0]); //coverage int totalsum = 0; List <InstrumentPerTA> listofITA = new List <InstrumentPerTA>(); bool isinthelist = false; foreach (DataRow dr in _dataSet.Tables[0].Rows) { foreach (TestingArea ta in DataRepository.GetAllTestingArea()) { if (ta.AreaName == Convert.ToString(dr["TestingArea"])) { foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea == ta) { isinthelist = true; break; } else { isinthelist = false; break; } } if (!isinthelist) { InstrumentPerTA IPTA = new InstrumentPerTA(); IPTA.TestingArea = ta; IPTA.TotalTestDone = 0;//added jan 17 listofITA.Add(IPTA); } foreach (InstrumentPerTA ia in listofITA) { if (ia.TestingArea.AreaName == Convert.ToString(dr["TestingArea"])) { ia.Quantity = ia.Quantity + Convert.ToInt32(dr["Qty"]); ia.TotalTestDone = ia.TotalTestDone + Convert.ToDecimal(dr["TestsDone"]); //added jan 17 } } } //totalsum = totalsum + Convert.ToInt32(dr["Qty"]); } } foreach (DataRow dr in _dataSet.Tables[0].Rows) { decimal c = 0; foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea.AreaName == Convert.ToString(dr["TestingArea"])) { totalsum = a.Quantity; c = (Convert.ToDecimal(Convert.ToDecimal(dr["TestsDone"]))) * 100 / a.TotalTestDone; break; } } decimal coverage = 0; if (totalsum != 0) { coverage = Convert.ToDecimal(dr["Qty"]) / totalsum; } chart2.Series["Contribution"].Points.AddXY(dr["InstrumentName"].ToString(), c / 100); chart2.Series["Coverage"].Points.AddXY(dr["InstrumentName"].ToString(), coverage); chart2.Series["Coverage"].LegendText = "Instrument Distribution"; } //end coverage //chart2.Series["Contribution"].Points.DataBindXY(dv, "InstrumentName", dv, "Contribution"); chart2.Series["Utilization"].Points.DataBindXY(dv, "InstrumentName", dv, "Utilization"); chart2.Series["Contribution"].LegendText = "Dx Contribution"; chart2.Series["Utilization"].LegendText = "Instrument Utilization"; } } chart2.Titles[0].Text = _title; chart2.Invalidate(); }
private void BindDataToChart() { IList<Instrument> _instList = new List<Instrument>(); GetChartData(); chart2.Series["Contribution"].Points.Clear(); chart2.Series["Utilization"].Points.Clear(); chart2.Series["Coverage"].Points.Clear(); chart2.Titles[0].Text = ""; if (_finfo.DatausageEnum == DataUsageEnum.DATA_USAGE1 || _finfo.DatausageEnum == DataUsageEnum.DATA_USAGE2) { if (_finfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC) { DataView dv = new DataView(_dataSet.Tables[0]); //coverage int totalsum = 0; List<InstrumentPerTA> listofITA = new List<InstrumentPerTA>(); bool isinthelist = false; foreach (DataRow dr in _dataSet.Tables[0].Rows) { foreach (TestingArea ta in DataRepository.GetAllTestingArea()) { if (ta.AreaName == Convert.ToString(dr["TestingArea"])) { //add instruments Instrument ins = DataRepository.GetInstrumentByName(Convert.ToString(dr["InstrumentName"])); _instList.Add(ins); foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea == ta) { isinthelist = true; break; } else { isinthelist = false; break; } } if (!isinthelist) { InstrumentPerTA IPTA = new InstrumentPerTA(); IPTA.TestingArea = ta; IPTA.TotalTestDone = 0;//added jan 17 listofITA.Add(IPTA); } foreach (InstrumentPerTA ia in listofITA) { if (ia.TestingArea.AreaName == Convert.ToString(dr["TestingArea"])) { ia.Quantity = ia.Quantity + Convert.ToInt32(dr["Qty"]); ia.TotalTestDone = ia.TotalTestDone + Convert.ToDecimal(dr["TestsDone"]); //added jan 17 } } } //totalsum = totalsum + Convert.ToInt32(dr["Qty"]); } } //bind instrument to list box Instrument instrument = new Instrument(); instrument.Id = 0; instrument.InstrumentName = "--All--"; _instList.Insert(0,instrument); lstInstrument.DataSource = _instList; lstInstrument.DisplayMember = "InstrumentName"; lstInstrument.ValueMember = "Id"; foreach (DataRow dr in _dataSet.Tables[0].Rows) { if(isSelectedInstrument(dr["InstrumentName"].ToString())) { decimal c = 0; foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea.AreaName == Convert.ToString(dr["TestingArea"])) { totalsum = a.Quantity; c = (Convert.ToDecimal(Convert.ToDecimal(dr["TestsDone"]))) * 100 / a.TotalTestDone; break; } } decimal coverage = 0; if (totalsum != 0) coverage = Convert.ToDecimal(dr["Qty"]) / totalsum; chart2.Series["Contribution"].Points.AddXY(dr["InstrumentName"].ToString(), c / 100); // chart2.Series["Contribution"].LegendText = "Dx Contribution"; chart2.Series["Coverage"].Points.AddXY(dr["InstrumentName"].ToString(), coverage); chart2.Series["Coverage"].LegendText = "Instrument Distribution"; } } //end coverage // chart2.Series["Contribution"].Points.DataBindXY(dv, "InstrumentName", dv, "Contribution"); chart2.Series["Utilization"].Points.DataBindXY(dv, "InstrumentName", dv, "Utilization"); chart2.Series["Contribution"].LegendText = "Dx Contribution"; chart2.Series["Utilization"].LegendText = "Instrument Utilization"; } } chart2.Titles[0].Text = _title; chart2.Invalidate(); }
private void BindDataToChart() { GetChartData(); chart2.Series["Coverage"].Points.Clear(); chart2.Titles[0].Text = ""; DataView dv = new DataView(_dataSet.Tables[0]); //coverage int totalsum = 0; List<InstrumentPerTA> listofITA = new List<InstrumentPerTA>(); bool isinthelist = false; foreach (DataRow dr in _dataSet.Tables[0].Rows) { foreach (TestingArea ta in DataRepository.GetAllTestingArea()) { if (ta.AreaName == Convert.ToString(dr["AreaName"])) { foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea == ta) { isinthelist = true; break; } else { isinthelist = false; break; } } if (!isinthelist) { InstrumentPerTA IPTA = new InstrumentPerTA(); IPTA.TestingArea = ta; listofITA.Add(IPTA); } foreach (InstrumentPerTA ia in listofITA) { if (ia.TestingArea.AreaName == Convert.ToString(dr["AreaName"])) { ia.Quantity = ia.Quantity + Convert.ToInt32(dr["Qty"]); } } } //totalsum = totalsum + Convert.ToInt32(dr["Qty"]); } } foreach (DataRow dr in _dataSet.Tables[0].Rows) { foreach (InstrumentPerTA a in listofITA) { if (a.TestingArea.AreaName == Convert.ToString(dr["AreaName"])) { totalsum = a.Quantity; break; } } decimal coverage = 0; if (totalsum != 0) coverage = Convert.ToDecimal(dr["Qty"]) / totalsum; chart2.Series["Coverage"].Points.AddXY(dr["InstrumentName"].ToString(), coverage); chart2.Series["Coverage"].LegendText = "Instrument Distribution"; } chart2.ChartAreas[0].AxisX.LabelStyle.IsEndLabelVisible = true; chart2.ChartAreas[0].AxisX.IsLabelAutoFit = true; chart2.ChartAreas[0].AxisX.LabelStyle.Angle = 90; chart2.ChartAreas[0].AxisX.LabelStyle.Interval = 1; // chart2.ChartAreas[0].AxisX.LabelStyle.IsStaggered = true; chart2.ChartAreas[0].AxisX.LabelStyle.TruncatedLabels = true; //end coverage chart2.Titles[0].Text = _title; chart2.Invalidate(); }