示例#1
0
        public IEnumerable <IDataPoint <TItem> > GenerateDataPoints(IEnumerable <TItem> items)
        {
            var data = items
                       .Select(d => new ListPoint <TItem>
            {
                X = XValue.Invoke(d),
                Y = new List <decimal?>
                {
                    Open.Invoke(d),
                    High.Invoke(d),
                    Low.Invoke(d),
                    Close.Invoke(d)
                },
                Items = new List <TItem> {
                    d
                }
            });

            if (OrderBy != null)
            {
                data = data.OrderBy(OrderBy);
            }
            else if (OrderByDescending != null)
            {
                data = data.OrderByDescending(OrderByDescending);
            }

            return(UpdateDataPoints(data, DataPointMutator));
        }
        public IEnumerable <IDataPoint <TItem> > GenerateDataPoints(IEnumerable <TItem> items)
        {
            IEnumerable <ListPoint <TItem> > data;

            if (YMinValue != null && YMaxValue != null)
            {
                data = items
                       .Select(e => new ListPoint <TItem>
                {
                    X = XValue.Invoke(e),
                    Y = new List <decimal?> {
                        YMinValue.Invoke(e), YMaxValue.Invoke(e)
                    },
                    Items = new List <TItem> {
                        e
                    },
                    FillColor = GetPointColor(e)
                });
            }
            else
            {
                data = items
                       .GroupBy(XValue)
                       .Select(d => new ListPoint <TItem>
                {
                    X = d.Key,
                    Y = new List <decimal?> {
                        d.AsQueryable().Min(YValue), d.AsQueryable().Max(YValue)
                    },
                    Items     = d,
                    FillColor = GetPointColor(d)
                });
            }

            if (OrderBy != null)
            {
                data = data.OrderBy(OrderBy);
            }
            else if (OrderByDescending != null)
            {
                data = data.OrderByDescending(OrderByDescending);
            }

            return(UpdateDataPoints(data, DataPointMutator));
        }
示例#3
0
        public IEnumerable <IDataPoint <TItem> > GenerateDataPoints(IEnumerable <TItem> items)
        {
            IEnumerable <DataPoint <TItem> > data;

            if (YValue != null)
            {
                data = items.Select(e => new DataPoint <TItem>
                {
                    X     = XValue.Invoke(e),
                    Y     = YValue.Invoke(e),
                    Items = new List <TItem> {
                        e
                    },
                    FillColor = GetPointColor(e)
                });
            }
            else if (YAggregate != null)
            {
                data = items.GroupBy(XValue)
                       .Select(d => new DataPoint <TItem>
                {
                    X         = d.Key,
                    Y         = YAggregate.Invoke(d),
                    Items     = d.ToList(),
                    FillColor = GetPointColor(d)
                });
            }
            else
            {
                return(new List <IDataPoint <TItem> >());
            }


            if (OrderBy != null)
            {
                data = data.OrderBy(OrderBy);
            }
            else if (OrderByDescending != null)
            {
                data = data.OrderByDescending(OrderByDescending);
            }

            return(UpdateDataPoints(data, DataPointMutator));
        }