Ejemplo n.º 1
0
        private IEnumerable <DateTime> GetVisibleDatesList()
        {
            //Вычисляем точки на временнОй сетке и отрисовываем их
            DateTime dt0 = CoordGrid.FromXAxisToDate(worldPointInLeftDownCorner.x);
            DateTime dt1 = CoordGrid.FromXAxisToDate(worldPointInRightUpCorner.x);

            if (CoordGrid is CoordinateGrid)
            {
                dt0 = (CoordGrid as CoordinateGrid).DateCorrection(dt0, dt1);
            }

            IEnumerable <DateTime> dateList = DateTimeTools.DividePeriodByKeyPoints(dt0, dt1, dateTextPool.FieldsAmount);

            return(dateList);
        }
            public void Update()
            {
                Vector3 pointerWorldPos;
                Vector2 pointerScreenPos;

                ChartDrawer.Instance.GetWorldPointerPosition(out pointerScreenPos, out pointerWorldPos);
                if (cachedXPos != Mathf.Round(pointerWorldPos.x))
                {
                    cachedXPos = Mathf.Round(pointerWorldPos.x);
                    DateTime fluctuationDate = CoordGrid.FromXAxisToDate(cachedXPos);
                    if (OnFluctuationSelect != null)
                    {
                        OnFluctuationSelect(ChartDataManager.GetPriceFluctuation(fluctuationDate));
                    }
                }
            }
Ejemplo n.º 3
0
        void Update()
        {
            worldPointInLeftDownCorner = cam.ViewportToWorldPoint(cachedZero);
            worldPointInRightUpCorner  = cam.ViewportToWorldPoint(cachedOne);

            visibleStartDate = CoordGrid.FromXAxisToDate(worldPointInLeftDownCorner.x).FloorToTimeFrame(chartDataManager.TFrame);
            if (visibleStartDate < chartDataManager.WorkBeginTime)
            {
                visibleStartDate = chartDataManager.WorkBeginTime;
            }

            visibleEndDate = CoordGrid.FromXAxisToDate(worldPointInRightUpCorner.x).UpToNextFrame(chartDataManager.TFrame);
            if (visibleEndDate > chartDataManager.WorkEndTime)
            {
                visibleEndDate = chartDataManager.WorkEndTime;
            }

            if (visibleStartDate != cachedStart || visibleEndDate != cachedEnd)
            {
                visibleFluctuations = chartDataManager.GetPriceFluctuationsByTimeFrame(visibleStartDate, visibleEndDate);
            }

            cachedStart = visibleStartDate;
            cachedEnd   = visibleEndDate;

            if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow))
            {
                autoscaleToggle.isOn = false;
            }

            if (NeedToBeUpdated)//Оптимизация
            {
                if (Autoscale)
                {
                    ScaleChart();
                }

                datesList  = GetVisibleDatesList();
                pricesList = GetVisiblePricesList();
                DrawChart();
            }
        }