private void verify(double[] labels)
        {
            LegendX legend = (LegendX)TestLegendXScroller.Legend;

            if (labels.Length != legend.LabelValues.Length)
            {
                System.Diagnostics.Debugger.Break();
                throw new Exception("There should be " + labels.Length + " legends, but there were " + legend.LabelValues.Length + ".");
            }
            for (int legendValueIndex = 0; legendValueIndex < labels.Length; legendValueIndex++)
            {
                if (labels[legendValueIndex] != Math.Round(legend.LabelValues[legendValueIndex], 3))
                {
                    System.Diagnostics.Debugger.Break();
                    throw new Exception("Legend[" + legendValueIndex + "] should be '" + labels[legendValueIndex] +
                                        "' but was '" + Math.Round(legend.LabelValues[legendValueIndex], 3) + "'");
                }
            }
        }
        //      -------

        /// <summary>
        /// Renders the vertical x-grid-line to the drawingContext, one line for each label in XLegend.
        /// </summary>
        protected override void OnCreateVisual(DrawingContext drawingContext, double width, double height, DrawingVisual _)
        {
            LegendX legendx = (LegendX)LegendScrollerX.Legend;
            //grid-lines use only 1 dimension. Both for x and y grid-line,
            double minDisplayValue = MinDisplayValues[0];

            // Create a GuidelineSet to get the lines exactly on a pixel
            GuidelineSet guidelines   = new GuidelineSet();
            double       halfPenWidth = StrokePen.Thickness / 2;

            foreach (double lableValue in legendx.LabelValues !)
            {
                double xPos = ScaleX * (lableValue - minDisplayValue);
                guidelines.GuidelinesX.Add(xPos + halfPenWidth);
            }

            drawingContext.PushGuidelineSet(guidelines);
            foreach (double lableValue in legendx.LabelValues)
            {
                double xPos = ScaleX * (lableValue - minDisplayValue);
                drawingContext.DrawLine(StrokePen, new Point(xPos, 0), new Point(xPos, height));
            }
            drawingContext.Pop();
        }
 /// <summary>
 /// Dummy constructor allowing public constructor to call TraceCreateStart() before construtor gets executed
 /// </summary>
 private LegendScrollerXTraced(DummyTraceClass dummyArgument, LegendX newLegendX) : base(newLegendX)
 {
 }
 /// <summary>
 /// Constructor supporting tracing of multiple XLegendScrollers with different names and special LegendX
 /// </summary>
 public LegendScrollerXTraced(string traceName, LegendX newLegendX) : this(TraceWPFEvents.TraceCreateStart(traceName), newLegendX)
 {
     TraceName = traceName;
     TraceWPFEvents.TraceCreateEnd(traceName);
 }
 /// <summary>
 /// Default Constructor with special LegendX
 /// </summary>
 public LegendScrollerXTraced(LegendX newLegendX) : this("XLegendScroller", newLegendX)
 {
 }
 /// <summary>
 /// Constructor using any x-axis legend
 /// </summary>
 public LegendScrollerX(LegendX legend) : base(legend)
 {
 }