private void GenerateStockStatusPieChart() { ReceiveDoc rec = new ReceiveDoc(); chartPie.UseWaitCursor = true; chartPie.Series.Clear(); int storeId = (cboStores.EditValue != null) ? Convert.ToInt32(cboStores.EditValue) : 0; curYear = Convert.ToInt32(cboYear.EditValue); var category = Convert.ToInt32(lkCategory.EditValue); curMont = (curYear == dtCurrent.Year) ? dtCurrent.Month : 12; //progressBar1.PerformStep(); Balance bal = new Balance(); Int64 stockin = bal.CountStockInByCategory(storeId, curMont, curYear ,category ); // progressBar1.PerformStep(); Int64 stockout = bal.CountStockOutByCategory(storeId, curMont, curYear, category); // progressBar1.PerformStep(); Int64 overstock = bal.CountOverStockByCategory(storeId, curMont, curYear, category); // progressBar1.PerformStep(); Int64 nearEOP = bal.CountNearEOPByCategory(storeId, curMont, curYear, category); // progressBar1.PerformStep(); Int64 BelowEOP = bal.CountBelowEOPByCategory(storeId, curMont, curYear, category); object[] obj = {stockin, stockout, overstock, nearEOP, BelowEOP}; DataTable dtList = new DataTable(); dtList.Columns.Add("Type"); dtList.Columns.Add("Value"); dtList.Columns[1].DataType = typeof (Int64); object[] oo = {"In Stock", obj[0]}; dtList.Rows.Add(oo); object[] oo2 = {"Stock Out", obj[1]}; dtList.Rows.Add(oo2); object[] oo3 = {"Over Stock", obj[2]}; dtList.Rows.Add(oo3); object[] oo4 = {"Near EOP", obj[3]}; dtList.Rows.Add(oo4); object[] oo5 = {"Below EOP", obj[4]}; dtList.Rows.Add(oo5); Series ser = new Series("pie", ViewType.Pie3D); ser.DataSource = dtList; ser.ArgumentScaleType = ScaleType.Qualitative; ser.ArgumentDataMember = "Type"; ser.ValueScaleType = ScaleType.Numerical; ser.ValueDataMembers.AddRange(new string[] {"Value"}); ser.PointOptions.PointView = PointView.ArgumentAndValues; ser.LegendText = "Key"; ser.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent; ser.PointOptions.ValueNumericOptions.Precision = 0; ((PieSeriesLabel) ser.Label).Position = PieSeriesLabelPosition.TwoColumns; ((PiePointOptions) ser.PointOptions).PointView = PointView.ArgumentAndValues; chartPie.Series.Add(ser); chartPie.Size = new System.Drawing.Size(1000, 500); //progressBar1.PerformStep(); GeneralInfo info = new GeneralInfo(); info.LoadAll(); lblHeader.Text = info.HospitalName + " Stock Status summary of year " + curYear + " of " + cboStores.Text; // progressBar1.Visible = false; chartPie.UseWaitCursor = false; }