s = dgvTanksandCompartments.CurrentRow.Cells["TANK_ID"].Value.ToString(); int i = Convert.ToInt32(s); DataSet dstankcompartment = objcls.GetTankId("spTrend_TankCompartmentVolume_DateTimeWise", i, mydate ); DataTable dttankcompartment = new DataTable(); dttankcompartment = dstankcompartment.Tables[0]; totalrow = dttankcompartment.Rows.Count; totalcol = dttankcompartment.Columns.Count; DateTime[] dt1 = new DateTime[totalrow]; DateTime[] dt2 = new DateTime[totalrow]; x = new double[totalrow]; y = new double[totalrow]; for (int j = 0; j < totalrow; j++) { dt1[j] = Convert.ToDateTime((dttankcompartment.Rows[j].ItemArray[0])); x[j] = (double)(new XDate(dt1[j])); } foreach (DataRow dr in dttankcompartment.Rows) { foreach (DataColumn dc in dttankcompartment .Columns ) { if((dr [dc ] == DBNull.Value)) { dr [dc ] = 0; } } } for (int m = 0; m < dttankcompartment.Rows.Count; m++) { y[m] = (float)Convert.ToDouble(dttankcompartment.Rows[m].ItemArray[2]); } GraphPane myPane1 = zedGraphControl1.GraphPane; myPane1.Title.Text = "Tanks and Compartment"; myPane1.XAxis.Title.Text = "Time"; myPane1.YAxis.Title.Text = "Volume"; myPane1.XAxis.Type = AxisType.DateAsOrdinal; myPane1.XAxis.Scale.Format = "dd-MM-yyyy HH:mm:ss.fff"; myPane1.XAxis.MajorGrid.IsVisible = true; myPane1.XAxis.MinorGrid.IsVisible = true; myPane1.XAxis.Scale.MajorUnit = DateUnit.Minute; myPane1.XAxis.Scale.MinorUnit = DateUnit.Minute; myPane1.XAxis.Title.IsVisible = true; //show the visibility of x axistitle. myPane1.XAxis.Scale.Min = 0; myPane1.XAxis.Scale.Max = 24; myPane1.XAxis.Scale.MajorStep = 1; myPane1.XAxis.MinorTic.Size = 1; myPane1.XAxis.Scale.FontSpec.Angle = 90; myPane1.XAxis.Title.FontSpec.Size = 10; myPane1.YAxis.Title.FontSpec.Size = 10; myPane1.XAxis.Scale.FontSpec.Size = 8; myPane1.YAxis.Scale.FontSpec.Size = 8; myPane1.YAxisList.Clear(); var y1 = myPane1.AddYAxis("Volume"); myPane1.YAxis.Scale.FontSpec.Size = 8; var y2 = myPane1.AddYAxis("Volume"); myPane1.YAxis.Scale.FontSpec.Size = 8; var y3 = myPane1.AddYAxis("Volume"); myPane1.YAxis.Scale.FontSpec.Size = 8; var y4 = myPane1.AddYAxis("Volume"); myPane1.YAxis.Scale.FontSpec.Size = 8; var y5 = myPane1.AddYAxis("Volume"); myPane1.YAxis.Scale.FontSpec.Size = 8; zedGraphControl1.GraphPane.CurveList.Clear(); zedGraphControl1.GraphPane.GraphObjList.Clear(); LineItem myCurve1 = myPane1.AddCurve("Smooth" , x, y, System.Drawing.Color.Red, SymbolType.Circle); myCurve1.Symbol.Fill = new Fill(System.Drawing.Color.Green); myCurve1.Symbol.Size = 4; myCurve1.Line.Width = 2; myCurve1.Label.Text = "Tank_ID_"+s ; //myCurve1.Label.FontSpec.Size = 6; zedGraphControl1.ZoomButtons = MouseButtons.None; zedGraphControl1.ZoomStepFraction = 0; zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)