Exemplo n.º 1
0
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            this.items.Clear();

            // Use the mapping to generate the points
            if (this.Mapping != null)
            {
                foreach (var item in this.ItemsSource)
                {
                    this.items.Add(this.Mapping(item));
                }

                return;
            }

            var filler = new ListFiller <HighLowItem>();

            filler.Add(this.DataFieldX, (p, v) => p.X         = Axis.ToDouble(v));
            filler.Add(this.DataFieldHigh, (p, v) => p.High   = Axis.ToDouble(v));
            filler.Add(this.DataFieldLow, (p, v) => p.Low     = Axis.ToDouble(v));
            filler.Add(this.DataFieldOpen, (p, v) => p.Open   = Axis.ToDouble(v));
            filler.Add(this.DataFieldClose, (p, v) => p.Close = Axis.ToDouble(v));
            filler.FillT(this.items, this.ItemsSource);
        }
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            var sourceAsListOfT = this.ItemsSource as List <T>;

            if (sourceAsListOfT != null)
            {
                this.itemsSourceItems     = sourceAsListOfT;
                this.ownsItemsSourceItems = false;
                return;
            }

            this.ClearItemsSourceItems();

            if (this.ValueField == null)
            {
                this.itemsSourceItems.AddRange(this.ItemsSource.OfType <T>());
            }
            else
            {
                // Using reflection to add items by value and color (optional)
                var filler = new ListFiller <T>();
                filler.Add(this.ValueField, (item, value) => item.Value = Convert.ToDouble(value));
                filler.Add(this.ColorField, (item, value) => item.Color = (OxyColor)value);
                filler.Fill(this.itemsSourceItems, this.ItemsSource);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Defines the data fields used by the code that reflects on the <see cref="ItemsSeries.ItemsSource" />.
 /// </summary>
 /// <param name="filler">The list filler.</param>
 protected virtual void DefineDataFields(ListFiller <T> filler)
 {
     filler.Add(this.DataFieldX, (item, value) => item.X         = Convert.ToDouble(value));
     filler.Add(this.DataFieldY, (item, value) => item.Y         = Convert.ToDouble(value));
     filler.Add(this.DataFieldSize, (item, value) => item.Size   = Convert.ToDouble(value));
     filler.Add(this.DataFieldValue, (item, value) => item.Value = Convert.ToDouble(value));
     filler.Add(this.DataFieldTag, (item, value) => item.Tag     = value);
 }
Exemplo n.º 4
0
        /// <summary>
        /// The update data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            var points = this.Points;

            points.Clear();

            // Use the mapping to generate the points
            if (this.Mapping != null)
            {
                foreach (var item in this.ItemsSource)
                {
                    points.Add(this.Mapping(item));
                }

                return;
            }

            // Get DataPoints from the items in ItemsSource
            // if they implement IScatterPointProvider
            // If DataFields are set, this is not used

            /*if (DataFieldX == null || DataFieldY == null)
             * {
             *  foreach (var item in ItemsSource)
             *  {
             *      var idpp = item as IScatterPointProvider;
             *      if (idpp == null)
             *      {
             *          continue;
             *      }
             *
             *      points.Add(idpp.GetScatterPoint());
             *  }
             *
             *  return;
             * }*/

            var dest = new List <IDataPoint>();

            // Using reflection to add points
            var filler = new ListFiller <ScatterPoint>();

            filler.Add(this.DataFieldX, (item, value) => item.X         = Convert.ToDouble(value));
            filler.Add(this.DataFieldY, (item, value) => item.Y         = Convert.ToDouble(value));
            filler.Add(this.DataFieldSize, (item, value) => item.Size   = Convert.ToDouble(value));
            filler.Add(this.DataFieldValue, (item, value) => item.Value = Convert.ToDouble(value));
            filler.Add(this.DataFieldTag, (item, value) => item.Tag     = value);
            filler.Fill(dest, this.ItemsSource);

            this.Points = dest;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource != null)
            {
                this.Items.Clear();

                var filler = new ListFiller <TornadoBarItem>();
                filler.Add(this.MinimumField, (item, value) => item.Minimum = Convert.ToDouble(value));
                filler.Add(this.MaximumField, (item, value) => item.Maximum = Convert.ToDouble(value));
                filler.FillT(this.Items, this.ItemsSource);
            }
        }
Exemplo n.º 6
0
        public void Fill_InvalidProperty_ThrowsException()
        {
            var target = new List<ScatterPoint>();

            var filler = new ListFiller<ScatterPoint>();
            filler.Add("B", (p, v) => p.X = Convert.ToDouble(v));
            filler.Fill(target, this.src);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            this.slices.Clear();

            var filler = new ListFiller <PieSlice>();

            filler.Add(this.LabelField, (item, value) => item.Label           = Convert.ToString(value));
            filler.Add(this.ValueField, (item, value) => item.Value           = Convert.ToDouble(value));
            filler.Add(this.ColorField, (item, value) => item.Fill            = (OxyColor)value);
            filler.Add(this.IsExplodedField, (item, value) => item.IsExploded = (bool)value);
            filler.FillT(this.slices, this.ItemsSource);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            var dest = new List <T>();

            // Using reflection to add points
            var filler = new ListFiller <T>();

            filler.Add(this.ValueField, (item, value) => item.Value = Convert.ToDouble(value));
            filler.Add(this.ColorField, (item, value) => item.Color = (OxyColor)value);
            filler.Fill(dest, this.ItemsSource);
            this.Items = dest;
        }
Exemplo n.º 9
0
        public void Fill_InvalidProperty_ThrowsException()
        {
            var target = new List <ScatterPoint>();

            var filler = new ListFiller <ScatterPoint>();

            filler.Add("B", (p, v) => p.X = Convert.ToDouble(v));
            filler.Fill(target, src);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Adds scatter points specified by a items source and data fields.
        /// </summary>
        /// <param name="target">The destination collection.</param>
        /// <param name="itemsSource">The items source.</param>
        /// <param name="dataFieldX">The data field x.</param>
        /// <param name="dataFieldY">The data field y.</param>
        /// <param name="dataFieldSize">The data field size.</param>
        /// <param name="dataFieldValue">The data field value.</param>
        /// <param name="dataFieldTag">The data field tag.</param>
        protected void AddScatterPoints(
            IList <T> target,
            IEnumerable itemsSource,
            string dataFieldX,
            string dataFieldY,
            string dataFieldSize,
            string dataFieldValue,
            string dataFieldTag)
        {
            var filler = new ListFiller <T>();

            filler.Add(dataFieldX, (item, value) => item.X         = Convert.ToDouble(value));
            filler.Add(dataFieldY, (item, value) => item.Y         = Convert.ToDouble(value));
            filler.Add(dataFieldSize, (item, value) => item.Size   = Convert.ToDouble(value));
            filler.Add(dataFieldValue, (item, value) => item.Value = Convert.ToDouble(value));
            filler.Add(dataFieldTag, (item, value) => item.Tag     = value);
            filler.FillT(target, itemsSource);
        }
Exemplo n.º 11
0
        public void Fill()
        {
            var target = new List<ScatterPoint>();

            var filler = new ListFiller<ScatterPoint>();
            filler.Add("A", (p, v) => p.X = Convert.ToDouble(v));
            filler.Fill(target, this.src);

            Assert.AreEqual(1, target.Count);
            Assert.AreEqual(3.14, target[0].X);
        }
Exemplo n.º 12
0
        public void Fill_NullProperty_IsIgnored()
        {
            var target = new List<ScatterPoint>();

            var filler = new ListFiller<ScatterPoint>();
            filler.Add(null, (p, v) => { });
            filler.Fill(target, this.src);

            Assert.AreEqual(1, target.Count);
            Assert.AreEqual(0, target[0].X);
        }
Exemplo n.º 13
0
        public void Fill()
        {
            var target = new List <ScatterPoint>();

            var filler = new ListFiller <ScatterPoint>();

            filler.Add("A", (p, v) => p.X = Convert.ToDouble(v));
            filler.Fill(target, src);

            Assert.AreEqual(1, target.Count);
            Assert.AreEqual(3.14, target[0].X);
        }
Exemplo n.º 14
0
        public void Fill_NullProperty_IsIgnored()
        {
            var target = new List <ScatterPoint>();

            var filler = new ListFiller <ScatterPoint>();

            filler.Add(null, (p, v) => { });
            filler.Fill(target, src);

            Assert.AreEqual(1, target.Count);
            Assert.AreEqual(0, target[0].X);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource != null)
            {
                this.Items.Clear();

                var filler = new ListFiller<IntervalBarItem>();
                filler.Add(this.MinimumField, (item, value) => item.Start = Convert.ToDouble(value));
                filler.Add(this.MaximumField, (item, value) => item.End = Convert.ToDouble(value));
                filler.FillT(this.Items, this.ItemsSource);
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Defines the data fields used by the code that reflects on the <see cref="ItemsSeries.ItemsSource" />.
 /// </summary>
 /// <param name="filler">The list filler.</param>
 protected override void DefineDataFields(ListFiller <ScatterErrorPoint> filler)
 {
     base.DefineDataFields(filler);
     filler.Add(this.DataFieldErrorX, (item, value) => item.ErrorX = Convert.ToDouble(value));
     filler.Add(this.DataFieldErrorY, (item, value) => item.ErrorY = Convert.ToDouble(value));
 }
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            this.items.Clear();

            // Use the mapping to generate the points
            if (this.Mapping != null)
            {
                foreach (var item in this.ItemsSource)
                {
                    this.items.Add(this.Mapping(item));
                }

                return;
            }

            var filler = new ListFiller<HighLowItem>();
            filler.Add(this.DataFieldX, (p, v) => p.X = this.ToDouble(v));
            filler.Add(this.DataFieldHigh, (p, v) => p.High = this.ToDouble(v));
            filler.Add(this.DataFieldLow, (p, v) => p.Low = this.ToDouble(v));
            filler.Add(this.DataFieldOpen, (p, v) => p.Open = this.ToDouble(v));
            filler.Add(this.DataFieldClose, (p, v) => p.Close = this.ToDouble(v));
            filler.FillT(this.items, this.ItemsSource);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Adds scatter points specified by a items source and data fields.
 /// </summary>
 /// <param name="dest">
 /// The destination collection.
 /// </param>
 /// <param name="itemsSource">
 /// The items source.
 /// </param>
 /// <param name="dataFieldX">
 /// The data field x.
 /// </param>
 /// <param name="dataFieldY">
 /// The data field y.
 /// </param>
 /// <param name="dataFieldSize">
 /// The data field size.
 /// </param>
 /// <param name="dataFieldValue">
 /// The data field value.
 /// </param>
 /// <param name="dataFieldTag">
 /// The data field tag.
 /// </param>
 protected void AddScatterPoints(
     IList<ScatterPoint> dest,
     IEnumerable itemsSource,
     string dataFieldX,
     string dataFieldY,
     string dataFieldSize,
     string dataFieldValue,
     string dataFieldTag)
 {
     var filler = new ListFiller<ScatterPoint>();
     filler.Add(dataFieldX, (item, value) => item.X = Convert.ToDouble(value));
     filler.Add(dataFieldY, (item, value) => item.Y = Convert.ToDouble(value));
     filler.Add(dataFieldSize, (item, value) => item.Size = Convert.ToDouble(value));
     filler.Add(dataFieldValue, (item, value) => item.Value = Convert.ToDouble(value));
     filler.Add(dataFieldTag, (item, value) => item.Tag = value);
     filler.FillT(dest, itemsSource);
 }
Exemplo n.º 19
0
        /// <summary>
        /// The update data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            var points = this.Points;
            points.Clear();

            // Use the mapping to generate the points
            if (this.Mapping != null)
            {
                foreach (var item in this.ItemsSource)
                {
                    points.Add(this.Mapping(item));
                }

                return;
            }

            // Get DataPoints from the items in ItemsSource
            // if they implement IScatterPointProvider
            // If DataFields are set, this is not used
            /*if (DataFieldX == null || DataFieldY == null)
            {
                foreach (var item in ItemsSource)
                {
                    var idpp = item as IScatterPointProvider;
                    if (idpp == null)
                    {
                        continue;
                    }

                    points.Add(idpp.GetScatterPoint());
                }

                return;
            }*/

            var dest = new List<IDataPoint>();

            // Using reflection to add points
            var filler = new ListFiller<ScatterPoint>();
            filler.Add(this.DataFieldX, (item, value) => item.X = Convert.ToDouble(value));
            filler.Add(this.DataFieldY, (item, value) => item.Y = Convert.ToDouble(value));
            filler.Add(this.DataFieldSize, (item, value) => item.Size = Convert.ToDouble(value));
            filler.Add(this.DataFieldValue, (item, value) => item.Value = Convert.ToDouble(value));
            filler.Add(this.DataFieldTag, (item, value) => item.Tag = value);
            filler.Fill(dest, this.ItemsSource);

            this.Points = dest;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Updates the data.
        /// </summary>
        protected internal override void UpdateData()
        {
            if (this.ItemsSource == null)
            {
                return;
            }

            this.slices.Clear();

            var filler = new ListFiller<PieSlice>();
            filler.Add(this.LabelField, (item, value) => item.Label = Convert.ToString(value));
            filler.Add(this.ValueField, (item, value) => item.Value = Convert.ToDouble(value));
            filler.Add(this.ColorField, (item, value) => item.Fill = (OxyColor)value);
            filler.Add(this.IsExplodedField, (item, value) => item.IsExploded = (bool)value);
            filler.FillT(this.slices, this.ItemsSource);
        }