void GetGridRows() { DataTable dt = new DataTable(); dt = retrieve.GetStocksGraph(ProductId, dateTimePickerStock.Value); profitAmount = retrieve.GetProductProfit(ProductId, dateTimePickerStock.Value); chartStocksBarChart.Series.Clear(); chartArea.Series.Clear(); chartStocksBarChart.Series.Add("Stocks"); chartArea.Series.Add("Stocks"); chartArea.Series["Stocks"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; for (int i = 0; i < dt.Rows.Count; i++) { chartStocksBarChart.Series["Stocks"].Points.AddXY(dt.Rows[i][1].ToString(), dt.Rows[i][0]); chartArea.Series["Stocks"].Points.AddXY(dt.Rows[i][1].ToString(), dt.Rows[i][0]); chartStocksBarChart.Series["Stocks"].Points[i].IsValueShownAsLabel = true; chartArea.Series["Stocks"].Points[i].IsValueShownAsLabel = true; } chartStocksBarChart.ChartAreas[0].AxisX.Interval = 1; chartArea.ChartAreas[0].AxisX.Interval = 1; chartArea.ChartAreas[0].BorderWidth = 10; //chartArea.BorderlineWidth = 10; chartStocksBarChart.Series[0].IsVisibleInLegend = false; chartArea.Series[0].IsVisibleInLegend = false; // GridView retrieve.ShowStockbyId(dataGridViewProduct, ProductIdGv, ProductNameGv, ProductCodeGv, ProductUnitGv, ProductMinValGv, AvailableStocks, ProductId, ReworkedStock, RejectedStock, OnHoldStock, PriceofStock); foreach (DataGridViewRow rows in dataGridViewProduct.Rows) { minStocks = Convert.ToDecimal(rows.Cells["ProductMinValGv"].Value); availableStock = Convert.ToDecimal(rows.Cells["AvailableStocks"].Value); if (Convert.ToDecimal(rows.Cells["ProductMinValGv"].Value) < Convert.ToDecimal(rows.Cells["AvailableStocks"].Value)) { rows.Cells["AvailableStocks"].Style.BackColor = Color.LightGreen; rows.Cells["AvailableStocks"].Style.ForeColor = Color.Black; } else { rows.Cells["AvailableStocks"].Style.BackColor = Color.IndianRed; rows.Cells["AvailableStocks"].Style.ForeColor = Color.Black; } labelAvaiableStockPrice.Text = "Available Stocks Price= Rs " + (Math.Round(Convert.ToDecimal(rows.Cells["PriceofStock"].Value))).ToString(); } // pictureBoxAvailableStock.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxBalance_Paint); // pictureBoxSalesProfit.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxProfit_Paint); }