Пример #1
0
        private void drawObjectGroup(DrawingContext dc, int part, DrawingObjectType type)
        {
            double highest = 0;
            double lowest  = double.MaxValue;

            foreach (var i in objects)
            {
                var obj = i.Value;
                if (obj.Part != part || obj.Type != type)
                {
                    continue;
                }
                double h = 0;
                double l = 0;
                //candle line.
                if (obj.Type == DrawingObjectType.CandleLine)
                {
                    h = MathUtil.getHighest(obj.Vals2, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                    if (h > highest)
                    {
                        highest = h;
                    }
                    l = MathUtil.getLowest(obj.Vals3, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                    if (l < lowest)
                    {
                        lowest = l;
                    }
                    continue;
                }

                h = MathUtil.getHighest(obj.Vals, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                if (h > highest)
                {
                    highest = h;
                }
                l = MathUtil.getLowest(obj.Vals, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                if (l < lowest)
                {
                    lowest = l;
                }

                //special for zero bars.
                if (obj.Type == DrawingObjectType.zVLines)
                {
                    if (highest < -lowest)
                    {
                        highest = -lowest;
                    }
                }
            }

            foreach (var i in objects)
            {
                var obj = i.Value;
                if (obj.Part == part && obj.Type == type)
                {
                    drawObj(dc, highest, lowest, obj);
                }
            }
        }
Пример #2
0
        internal void addDrawingObj(string id, double[] points, int part, Color c, double thickness, DrawingObjectType type)
        {
            DrawingObject obj = new DrawingObject()
            {
                Vals      = points,
                Part      = part,
                Color     = c,
                Thickness = thickness,
                Type      = type,
            };

            if (objects.ContainsKey(id))
            {
                objects[id] = obj;
                return;
            }


            objects.Add(id, obj);
        }
        private void drawObjectGroup(DrawingContext dc, int part, DrawingObjectType type)
        {
            double highest = 0;
            double lowest = double.MaxValue;

            foreach (var i in objects)
            {
                var obj = i.Value;
                if (obj.Part != part || obj.Type != type)
                {
                    continue;
                }
                double h = 0;
                double l = 0;
                //candle line.
                if (obj.Type == DrawingObjectType.CandleLine)
                {
                    h = MathUtil.getHighest(obj.Vals2, drawItemStartIndex, drawItemStartIndex + drawItemCount,priceList.ItemCount);
                    if (h > highest)
                    {
                        highest = h;
                    }


                    l = MathUtil.getLowest(obj.Vals3, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                    if (l < lowest)
                    {
                        lowest = l;
                    }
                    continue;
                }

                h = MathUtil.getHighest(obj.Vals, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                if (h > highest)
                {
                    highest = h;
                }
                l = MathUtil.getLowest(obj.Vals, drawItemStartIndex, drawItemStartIndex + drawItemCount, priceList.ItemCount);
                if (l < lowest)
                {
                    lowest = l;
                }

                //special for zero bars.
                if (obj.Type == DrawingObjectType.zVLines)
                {
                    if (highest < -lowest)
                    {
                        highest = -lowest;
                    }
                }

            }

            foreach (var i in objects)
            {
                var obj = i.Value;
                if (obj.Part == part && obj.Type == type)
                {
                    drawObj(dc, highest, lowest, obj);
                }
            }
        }
Пример #4
0
 public DrawingObject(DrawingObjectType type, Rectangle bounds)
 {
     this.Type   = type;
     this.Bounds = bounds;
 }
        internal void addDrawingObj(string id, double[] points, int part, Color c, double thickness,DrawingObjectType type )
        {
            DrawingObject obj =new DrawingObject()
            {
                Vals = points,
                Part = part,
                Color = c,
                Thickness = thickness,
                Type=type,
            };

            if (objects.ContainsKey(id))
            {
                objects[id] = obj;
                return;
            }

           
            objects.Add(id,obj);

        }