hye everyone,im using the zedgraph to show the real time of water level. the water level range is 0-4.the x axis is the time( every hour).here are the code.
private void zedGraphControl1_Load(object sender, EventArgs e)
{
// pane use to draw the chart
GraphPane mypane = new GraphPane();
//point pair list
PointPairList listPointsOne = new PointPairList();
PointPairList listPointsTwo = new PointPairList();
//line item
LineItem myCurveOne;
//set the pane
mypane = zedGraphControl1.GraphPane;
//set the title
mypane.Title.Text = "Flood Monitoring System\n";
mypane.Title.IsVisible = true; // show the visibility of the title
//set the X axis
mypane.XAxis.Type = AxisType.DateAsOrdinal;
mypane.XAxis.Scale.Format = "HH:mm:ss";
mypane.XAxis.Title.Text = "Time";
mypane.XAxis.MajorGrid.IsVisible = true;
mypane.XAxis.MinorGrid.IsVisible = true;
mypane.XAxis.Scale.MajorUnit = DateUnit.Minute;
mypane.XAxis.Scale.MinorUnit = DateUnit.Minute;
mypane.XAxis.Title.IsVisible = true; //show the visibility of x axis title.
mypane.XAxis.Scale.Min = 0;
mypane.XAxis.Scale.Max = 24;
mypane.XAxis.Scale.MajorStep = 1;
mypane.XAxis.MinorTic.Size = 1;
//set the Y axis
mypane.YAxis.Type = AxisType.Linear;
mypane.YAxis.Title.Text = "Water Level";
mypane.YAxis.Scale.Format = @"0.0";
mypane.YAxis.Title.IsVisible = true;
mypane.YAxis.MajorGrid.IsVisible = true;
mypane.YAxis.Scale.Min = 0;
mypane.YAxis.Scale.Max = 4;
mypane.YAxis.Scale.MajorStep = 1;
//create dummy data
double[] y = {1,2,3,2,1,4,2,4 };
double[] x = {0,10,14,16,18,20,22,24};
//add curve to the pane
myCurveOne = mypane.AddCurve("WaterLevel",x,y,Color.Red,SymbolType.Triangle);
myCurveOne.Line.Width = 1.0F;
//function that makesure the graph updated automatically
zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();
zedGraphControl1.Refresh();
}
my problem is that no data is appeared on the graph as well as the axis title and the title of the graph..