예제 #1
0
 protected override void OnBindingPathChanged(DependencyPropertyChangedEventArgs args)
 {
     HorizontalCustomValues.Clear();
     VerticalCustomValues.Clear();
     YValues.Clear();
     base.OnBindingPathChanged(args);
 }
        private void CalculateXOutputValues(Size constraint)
        {
            YValues.Clear();
            double start_width    = constraint.Width - _largestLabelSize.Width / 2;
            double pixelIncrement = CalculatePixelIncrements(constraint, _largestLabelSize);
            double lowPixel       = start_width - (InternalChildren.Count - 1) * pixelIncrement;
            double highPixel      = start_width;

            if (highPixel < lowPixel)
            {
                return;
            }
            for (int i = 0; i < DataValues.Count; i++)
            {
                double output = lowPixel + ((highPixel - lowPixel) / (_highValue - _lowValue)) * (DataValues[i] - _lowValue);
                YValues.Add(output);
            }
            if (_startsAtZero || (!_allNegativeValues && !_allPositiveValues))
            {
                Origin = lowPixel + ((highPixel - lowPixel) / (_highValue - _lowValue)) * (0.0 - _lowValue);
            }
            else if (!_startsAtZero && _allPositiveValues)
            {
                Origin = lowPixel;
            }
            else
            {
                Origin = highPixel;
            }
        }
예제 #3
0
 /// <summary>
 /// Called when DataSource property changed
 /// </summary>
 /// <param name="oldValue"></param>
 /// <param name="newValue"></param>
 protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue)
 {
     YValues.Clear();
     sizeValues.Clear();
     GeneratePoints(new string[] { YBindingPath, Size }, YValues, sizeValues);
     this.UpdateArea();
 }
예제 #4
0
 /// <summary>
 /// Called when DataSource property changed
 /// </summary>
 /// <param name="oldValue"></param>
 /// <param name="newValue"></param>
 protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue)
 {
     YValues.Clear();
     Segment = null;
     GeneratePoints(new string[] { YBindingPath }, YValues);
     isPointValidated = false;
     this.UpdateArea();
 }
예제 #5
0
        private void XYLineChartNodeModel_PortDisconnected(PortModel port)
        {
            // Clear UI when a input port is disconnected
            if (port.PortType == PortType.Input && this.State == ElementState.Active)
            {
                Labels.Clear();
                XValues.Clear();
                YValues.Clear();
                Colors.Clear();

                RaisePropertyChanged("DataUpdated");
            }
        }
        private void CalculateYOutputValues(Size constraint)
        {
            YValues.Clear();
            double start_val, lowPixel, highPixel;
            double pixelIncrement = CalculatePixelIncrements(constraint, _largestLabelSize);

            if (Orientation.Equals(Orientation.Vertical))
            {
                start_val = constraint.Height - _largestLabelSize.Height / 2;
                lowPixel  = start_val - (InternalChildren.Count - 1) * pixelIncrement;
                highPixel = start_val;
            }
            else
            {
                start_val = constraint.Width - _largestLabelSize.Width / 2;
                lowPixel  = start_val - (InternalChildren.Count - 1) * pixelIncrement;
                highPixel = start_val;
            }
            if (highPixel < lowPixel)
            {
                return;
            }
            for (int i = 0; i < DataValues.Count; i++)
            {
                double outVal = highPixel - ((highPixel - lowPixel) / (_highValue - _lowValue)) * (DataValues[i] - _lowValue);
                YValues.Add(outVal);
            }
            if (_startsAtZero || (!_allNegativeValues && !_allPositiveValues))
            {
                Origin = highPixel - ((highPixel - lowPixel) / (_highValue - _lowValue)) * (0.0 - _lowValue);
            }
            else if (!_startsAtZero && _allPositiveValues)
            {
                Origin = highPixel;
            }
            else
            {
                Origin = lowPixel;
            }
        }
예제 #7
0
 /// <summary>
 /// Method for Generate Points for XYDataSeries
 /// </summary>
 protected internal override void GeneratePoints()
 {
     HorizontalCustomValues.Clear();
     VerticalCustomValues.Clear();
     YValues.Clear();
     if (YBindingPath != null && HorizontalErrorPath != null && VerticalErrorPath != null)
     {
         GeneratePoints(new[] { YBindingPath, HorizontalErrorPath, VerticalErrorPath }, YValues, HorizontalCustomValues, VerticalCustomValues);
     }
     else if (YBindingPath != null && HorizontalErrorPath != null)
     {
         GeneratePoints(new[] { YBindingPath, HorizontalErrorPath }, YValues, HorizontalCustomValues);
     }
     else if (YBindingPath != null && VerticalErrorPath != null)
     {
         GeneratePoints(new[] { YBindingPath, VerticalErrorPath }, YValues, VerticalCustomValues);
     }
     else if (YBindingPath != null)
     {
         GeneratePoints(new[] { YBindingPath }, YValues);
     }
 }
예제 #8
0
        /// <summary>
        /// Called when DataSource property changed
        /// </summary>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue)
        {
            HorizontalCustomValues.Clear();
            VerticalCustomValues.Clear();
            YValues.Clear();
            if (YBindingPath != null && HorizontalErrorPath != null && VerticalErrorPath != null)
            {
                GeneratePoints(new[] { YBindingPath, HorizontalErrorPath, VerticalErrorPath }, YValues, HorizontalCustomValues, VerticalCustomValues);
            }
            else if (YBindingPath != null && HorizontalErrorPath != null)
            {
                GeneratePoints(new[] { YBindingPath, HorizontalErrorPath }, YValues, HorizontalCustomValues);
            }
            else if (YBindingPath != null && VerticalErrorPath != null)
            {
                GeneratePoints(new[] { YBindingPath, VerticalErrorPath }, YValues, VerticalCustomValues);
            }
            else if (YBindingPath != null)
            {
                GeneratePoints(new[] { YBindingPath }, YValues);
            }

            this.UpdateArea();
        }
예제 #9
0
 public void ClearAll()
 {
     XValues.Clear();
     YValues.Clear();
     ZValues.Clear();
 }
예제 #10
0
 protected override void OnBindingPathChanged(DependencyPropertyChangedEventArgs args)
 {
     YValues.Clear();
     Segment = null;
     base.OnBindingPathChanged(args);
 }
예제 #11
0
        private void UpdateSample(TimeSpan sampleTime, TimeSpan sampleBackFor)
        {
            var sampleLimit = DateTimeOffset.Now - sampleBackFor;

            XMinimum = sampleLimit.ToUnixTimeMilliseconds();

            var values = _history.SelectTimeSampleBackwards(
                x => x.Date,
                x => x.Balance,
                sampleTime,
                sampleLimit,
                DateTime.Now);

            XValues.Clear();
            YValues.Clear();

            foreach (var(timestamp, balance) in values.Reverse())
            {
                YValues.Add((double)balance.ToDecimal(MoneyUnit.BTC));
                XValues.Add(timestamp.ToUnixTimeMilliseconds());
            }

            if (YValues.Any())
            {
                var maxY = YValues.Max();
                YLabels = new List <string> {
                    "0", (maxY / 2).ToString("F2"), maxY.ToString("F2")
                };
            }
            else
            {
                YLabels = null;
            }

            if (XValues.Any())
            {
                var minX  = XValues.Min();
                var maxX  = XValues.Max();
                var halfX = minX + ((maxX - minX) / 2);

                var range = DateTimeOffset.FromUnixTimeMilliseconds((long)maxX) -
                            DateTimeOffset.FromUnixTimeMilliseconds((long)minX);

                if (range <= TimeSpan.FromDays(1))
                {
                    XLabels = new List <string>
                    {
                        DateTimeOffset.FromUnixTimeMilliseconds((long)minX).DateTime.ToString("t"),
                        DateTimeOffset.FromUnixTimeMilliseconds((long)halfX).DateTime.ToString("t"),
                        DateTimeOffset.FromUnixTimeMilliseconds((long)maxX).DateTime.ToString("t"),
                    };
                }
                else if (range <= TimeSpan.FromDays(7))
                {
                    XLabels = new List <string>
                    {
                        DateTimeOffset.FromUnixTimeMilliseconds((long)minX).DateTime.ToString("ddd MMM-d"),
                        DateTimeOffset.FromUnixTimeMilliseconds((long)halfX).DateTime.ToString("ddd MMM-d"),
                        DateTimeOffset.FromUnixTimeMilliseconds((long)maxX).DateTime.ToString("ddd MMM-d"),
                    };
                }
                else
                {
                    XLabels = new List <string>
                    {
                        DateTimeOffset.FromUnixTimeMilliseconds((long)minX).DateTime.ToString("MMM-d"),
                        DateTimeOffset.FromUnixTimeMilliseconds((long)halfX).DateTime.ToString("MMM-d"),
                        DateTimeOffset.FromUnixTimeMilliseconds((long)maxX).DateTime.ToString("MMM-d"),
                    };
                }
            }
            else
            {
                XLabels = null;
            }
        }