Bug: DDD can't able to handle step(ON/OFF) signals, If the time stamp is too small or same

Aug 20, 2010 at 10:56 AM

Hi,

I found a seviour bug in DDD.

 const int N = 2000;
            List<double> y = new List<double>();
            List<DateTime> x = new List<DateTime>();

            DateTime dt = DateTime.Now.AddMinutes(-50);
            DateTime newDt = dt;
            Random rand = new Random();
            double val = 0;
            for (int i = 0; i < N; i++)
            {
                if (i < 200)
                {
                    val = 0;
                    dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 200 && i < 400)
                {
                    val = 1;
                    dt = dt.AddMilliseconds(rand.NextDouble());
                    if (val != y[y.Count - 1])
                    {
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                    }

                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 400 && i < 600)
                {
                    val = 0;
                    if (val != y[y.Count - 1])
                    {
                        dt = dt.AddMilliseconds(rand.NextDouble());
                        x.Add(dt);
                        y.Add(val);
                        newDt = dt;
                    }

                    newDt = newDt.AddMilliseconds(rand.NextDouble());
                    ////dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 600 && i < 800)
                {
                    val = 1;
                    
                    if (val != y[y.Count - 1])
                    {
                        dt = newDt;
                        x.Add(dt);
                        y.Add(y[y.Count-1]);
                    }

                    dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 800 && i < 1000)
                {
                    val = 0;
                    if (val != y[y.Count - 1])
                    {
                        dt = dt.AddMilliseconds(rand.NextDouble());
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                        newDt = dt;
                    }

                    newDt = newDt.AddMilliseconds(rand.NextDouble());
                    //dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 1000 && i < 1200)
                {
                    val = 1;
                    
                    if (val != y[y.Count - 1])
                    {
                        dt = newDt;
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                    }

                    dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 1200 && i < 1400)
                {
                    val = 0;
                    if (val != y[y.Count - 1])
                    {
                        dt = dt.AddMilliseconds(rand.NextDouble());
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                        newDt = dt;
                    }

                    newDt = newDt.AddMilliseconds(rand.NextDouble());
                    ////dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 1400 && i < 1600)
                {
                    val = 1;
                    
                    if (val != y[y.Count - 1])
                    {
                        dt = newDt;
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                    }

                    dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 1600 && i < 1800)
                {
                    val = 0;
                    if (val != y[y.Count - 1])
                    {
                        dt = dt.AddMilliseconds(rand.NextDouble());
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                        newDt = dt;
                    }

                    newDt = newDt.AddMilliseconds(rand.NextDouble());
                    ////dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
                else if (i >= 1800)
                {
                    val = 1;
                    
                    if (val != y[y.Count - 1])
                    {
                        dt = newDt;
                        x.Add(dt);
                        y.Add(y[y.Count - 1]);
                    }

                    dt = dt.AddMilliseconds(rand.NextDouble());
                    x.Add(dt);
                    y.Add(val);
                }
            }

            EnumerableDataSource<double> xs = new EnumerableDataSource<double>(y);
            xs.SetYMapping(_y => _y);
            EnumerableDataSource<DateTime> ys = new EnumerableDataSource<DateTime>(x);
            ////this.dateAxis = new CustomHorizontalDateTimeAxis();
            this.axis = new HorizontalDateTimeAxis();
            ys.SetXMapping(axis.ConvertToDouble);
            CompositeDataSource ds = new CompositeDataSource(xs, ys);
            this.plotter.AddLineGraph(ds);

XAML part is

<Grid> 
	<c:TimeChartPlotter Name="plotter"/> 
	<c:HorizontalDateTimeAxis Name="axis"/>
</Grid>
 

I builded it and I just ran the exe. Some unexpected cross line came in the chart, I resized(increased size of ) the window. Suddenly those unexpected cross lines are gone.

Note: This problem may be because I used same timestamp.

Regards

Ravi.Battula.