public void ContainsTest()
        {
            var range = new DoubleRange(-1.2, +3.4);

            Assert.IsFalse(range.Contains(double.NegativeInfinity));
            Assert.IsFalse(range.Contains(-10));
            Assert.IsTrue(range.Contains(-1.2));
            Assert.IsTrue(range.Contains(0.0));
            Assert.IsTrue(range.Contains(+3.4));
            Assert.IsFalse(range.Contains(+10));
            Assert.IsFalse(range.Contains(Double.PositiveInfinity));
            Assert.IsFalse(range.Contains(double.NaN));
        }
Beispiel #2
0
        public void RangeDoesContainItemUpperBounds()
        {
            var range1 = new DoubleRange(3, 10);

            Assert.IsTrue(range1.Contains(10));
        }
Beispiel #3
0
        public void RangeDoesnotContainItemLower()
        {
            var range1 = new DoubleRange(3, 10);

            Assert.IsFalse(range1.Contains(1));
        }
Beispiel #4
0
        public void RangeDoesContainItem()
        {
            var range1 = new DoubleRange(3, 10);

            Assert.IsTrue(range1.Contains(5));
        }
Beispiel #5
0
        private void UpdateMarkers()
        {
            if (DataPointTemplate == null)
            {
                // This is a line chart without markers.
                return;
            }

            double markerThreshold = MarkerThreshold;
            if (!Numeric.IsNaN(markerThreshold))
            {
                int numberOfDataPoints = _endIndexExclusive - _startIndex;
                int allowedNumberOfDataPoints = (int)(XAxis.Length * markerThreshold);
                if (numberOfDataPoints > allowedNumberOfDataPoints)
                {
                    // The number of data points exceeds the MarkerThreshold.
                    return;
                }
            }

            var yAxis = YAxis;
            var originY = yAxis.OriginY;
            var length = yAxis.Length;
            var yRange = new DoubleRange(originY - length, originY);

            // Loop over data points and create markers.
            for (int i = _startIndex; i < _endIndexExclusive; i++)
            {
                // Draw only data which is in the visible data range.
                if (!yRange.Contains(_yPositions[i]))
                    continue;

                // Create marker
                DataPoint data = Data[i];
                FrameworkElement marker = CreateDataPoint(data.DataContext ?? data);
                if (marker == null)
                    return;

                Canvas.Children.Add(marker);

                // Save index in tag for PositionMarker().
                // Alternatively, we could set the property as an attached property.
                marker.Tag = i;

            #if SILVERLIGHT
                // In Silverlight: Position marker immediately, because some elements do not raise a
                // SizeChanged event.
                PositionMarker(marker);
            #endif

                // Position the marker as soon as it is measured.
                marker.SizeChanged += MarkerSizeChanged;
            }
        }
Beispiel #6
0
        public void ContainsTest()
        {
            var range = new DoubleRange(-1.2, +3.4);

            Assert.IsFalse(range.Contains(double.NegativeInfinity));
            Assert.IsFalse(range.Contains(-10));
            Assert.IsTrue(range.Contains(-1.2));
            Assert.IsTrue(range.Contains(0.0));
            Assert.IsTrue(range.Contains(+3.4));
            Assert.IsFalse(range.Contains(+10));
            Assert.IsFalse(range.Contains(Double.PositiveInfinity));
            Assert.IsFalse(range.Contains(double.NaN));
        }