コード例 #1
0
        //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
        private void ScaleChart()
        {
            if (!IsSettingsSet)
            {
                return;
            }


            double highestPriceOnScreen = CoordGrid.FromYAxisToPrice(worldPointInRightUpCorner.y);
            double lowestPriceOnScreen  = CoordGrid.FromYAxisToPrice(worldPointInLeftDownCorner.y);

            double highestPrice = visibleFluctuations.Max(f => f.High);
            double lowestPrice  = visibleFluctuations.Min(f => f.Low);

            double priceRange = highestPrice - lowestPrice;
            float  new_y      = CoordGrid.FromPriceToYAxis((float)(lowestPrice + priceRange / 2));


            if (Math.Abs(new_y / cam.transform.position.y - 1) > 1e-4)
            {
                cam.transform.position = new Vector3(cam.transform.position.x, new_y, cam.transform.position.z);
            }

            if (highestPrice != lowestPrice)
            {
                CoordGrid.Scale *= (1 - chartOffsetFromVerticalBorders) * (float)((highestPriceOnScreen - lowestPriceOnScreen) / priceRange);
            }
        }
コード例 #2
0
        private IEnumerable <decimal> GetVisiblePricesList()
        {
            //Вывод цен на экран
            decimal        lowestPrice  = (decimal)CoordGrid.FromYAxisToPrice(worldPointInLeftDownCorner.y);
            decimal        highestPrice = (decimal)CoordGrid.FromYAxisToPrice(worldPointInRightUpCorner.y);
            List <decimal> pricesList   = Ariphmetic.DividePriceRangeByKeyPoints(lowestPrice, highestPrice, priceTextPool.FieldsAmount);

            return(pricesList);
        }