elektra Posted April 26, 2010 Report Share Posted April 26, 2010 Hello, I have created 3 Dataseries at runtime and wanted to fill the 3 series simultaneously every 3 seconds with data (Datetime, value). This is the code: //Members int pointsCount = 0; DateTime todayDate = DateTime.Now; int nTotalPoints = 30; //----Realtime settings chart1.ExtraStyle &= ~ChartStyles.CacheImage;// Removing this flag is required to support Fast Scroll chart1.Data.Points = nTotalPoints; // nTotalPoints = 30 //3 series, 10 days, 1 point added everyday chart1.RealTime.BufferSize = (int) (DateTime.Now.AddDays(10).ToOADate() - DateTime.Now.ToOADate()); chart1.RealTime.Mode = RealTimeMode.Loop; chart1.RealTime.LoopMarker.Color = Color.Red; //---Axis-X settings chart1.AxisX.Min = DateTime.Now.ToOADate(); chart1.AxisX.LabelsFormat.Format = AxisFormat.DateTime; chart1.AxisX.Grids.Major.Visible = true; //Axis-Y settings chart1.AxisY.Step = 2; chart1.AxisY.Min = 0; chart1.AxisY.Max = 10; chart1.UpdateSizeNow(); private void timer1_Tick(object sender, EventArgs e) { if (pointsCount < nTotalPoints - 2) pointsCount = anzahlPoints + 3; else { if (pointsCount == nTotalPoints) { chart1.RealTime.Mode = RealTimeMode.Scroll; pointsCount = pointsCount+ 3; } } chart1.RealTime.BeginAddData(3, RealTimeAction.Append); chart1.Data.X[0, 0] = todayDate.ToOADate(); chart1.Data.Y[0, 0] = 5; chart1.Data.X[1, 0] = todayDate.ToOADate(); chart1.Data.Y[1, 0] = 7; chart1.Data.X[2, 0] = todayDate.ToOADate(); chart1.Data.Y[2, 0] = 9; chart1.RealTime.EndAddData(true, true); todayDate = todayDate.AddDays(1); } Result: I'm not getting lines at the application start. After the third point, markers are linked successively in pairs. My question: - How to choose the right buffersize for Datetime-X-Values? - How th show Datetime labels on the X-Axis? - I want to reproduce the RealtimeCharts-Sample (no markers) with Datetime value, without knowing how many points I have in my Database? Thank you in advance Quote Link to comment Share on other sites More sharing options...
elektra Posted April 30, 2010 Author Report Share Posted April 30, 2010 More Information: I want to update every 5 min 6 dataseries through adding one point to each one. I have the following questions: -how to choose the right buffer-size to have a chartview where, forexample the data of 1hour are plotted (corresponds to 60 min/5 min = 12points) - how to choose the step of 5 min? - How to display the first and last label on the X-Axis? - I want the chart to still updated while resizing the window (not Throwing an Exception) Thank you in Advance! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.