Пример #1
0
        public IEnumerable <GraphInnerState> GetCurrentStates(int totalDays, DateTime selectedDate)
        {
            var daysInQuarter = (float)Period / 4;
            var states        = new List <GraphInnerState>(3);

            var days = new int[] { -3, -2, -1, 0, 1, 2, 3 };

            foreach (int day in days)
            {
                float remainder   = ((float)(totalDays + day) / Period) % 1.0f;
                float dayInPeriod = Period * remainder;

                int quarter = GetQuarter(dayInPeriod, daysInQuarter);

                float state = GetY(quarter, dayInPeriod, daysInQuarter);

                float t = 0;

                t = state / (Period / 4);

                var gs = new GraphInnerState()
                {
                    IsGrowing = quarter == 1 || quarter == 4,
                    State     = t,
                    Date      = selectedDate.AddDays(day)
                };

                states.Add(gs);
            }

            return(states);
        }
Пример #2
0
        public GraphInnerState GetCurrentState(int totalDays, int day, DateTime selectedDate)
        {
            var   daysInQuarter = (float)Period / 4;
            float remainder     = ((float)(totalDays + day) / Period) % 1.0f;
            float dayInPeriod   = Period * remainder;

            int quarter = GetQuarter(dayInPeriod, daysInQuarter);

            float state = GetY(quarter, dayInPeriod, daysInQuarter);

            float t = 0;

            t = state / (Period / 4);

            var gs = new GraphInnerState()
            {
                IsGrowing = quarter == 1 || quarter == 4,
                State     = t,
                Date      = selectedDate.AddDays(day)
            };

            return(gs);
        }