예제 #1
0
        private void GetSummaryValues()
        {
            if (ItemsSource == null || string.IsNullOrEmpty(SummaryBindingPath))
            {
                return;
            }

            IEnumerator       enumerator = ItemsSource.GetEnumerator();
            PropertyInfo      summaryPropertyInfo;
            IPropertyAccessor summaryPropertyAccessor = null;

            if (SummaryValues != null)
            {
                SummaryValues.Clear();
            }
            else
            {
                SummaryValues = new List <bool>();
            }

            IList <bool> summaryValues = SummaryValues;

            if (enumerator.MoveNext())
            {
                summaryPropertyInfo = ChartDataUtils.GetPropertyInfo(enumerator.Current, SummaryBindingPath);

                if (summaryPropertyInfo != null)
                {
                    summaryPropertyAccessor = FastReflectionCaches.PropertyAccessorCache.Get(summaryPropertyInfo);
                }

                if (summaryPropertyAccessor == null)
                {
                    return;
                }

                Func <object, object> summaryGetMethod = summaryPropertyAccessor.GetMethod;

                if (summaryGetMethod(enumerator.Current) != null && summaryGetMethod(enumerator.Current).GetType().IsArray)
                {
                    return;
                }

                try
                {
                    do
                    {
                        object summaryVal = summaryGetMethod(enumerator.Current);
                        summaryValues.Add(Convert.ToBoolean(summaryVal));
                    }while (enumerator.MoveNext());
                }
                catch
                {
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Method implementation for Set points to given index
        /// </summary>
        /// <param name="index"></param>
        /// <param name="obj"></param>
        /// <param name="replace"></param>
        protected override void SetIndividualPoint(int index, object obj, bool replace)
        {
            // Updating summary value of the series.
            if (SummaryBindingPath != null)
            {
                object summaryValue = GetArrayPropertyValue(obj, new string[] { SummaryBindingPath });
                if (replace && SummaryValues.Count > index)
                {
                    SummaryValues[index] = Convert.ToBoolean(summaryValue);
                }
                else
                {
                    SummaryValues.Insert(index, Convert.ToBoolean(summaryValue));
                }
            }

            // Updating x and y value of the series.
            base.SetIndividualPoint(index, obj, replace);

            // Updating segment's SegmentType property based on yvalue.
            if (SummaryValues != null && index < Segments.Count && index < YValues.Count)
            {
                WaterfallSegment segment = Segments[index] as WaterfallSegment;
                if (SummaryValues[index] == false)
                {
                    if (YValues[index] < 0)
                    {
                        segment.SegmentType = WaterfallSegmentType.Negative;
                    }
                    else
                    {
                        segment.SegmentType = WaterfallSegmentType.Positive;
                    }
                }
                else
                {
                    segment.SegmentType = WaterfallSegmentType.Sum;
                }

                // Updating changed segment interior property.
                segment.BindProperties();
            }
        }