Exemplo n.º 1
0
        protected override Range <IComparable> GetActualYDataRange()
        {
            StackedColumnSeriesPresenter columnSeriesPresenter = this.SeriesPresenter as StackedColumnSeriesPresenter;
            List <XYSeries>    counterpartDataSeries           = columnSeriesPresenter.GetCounterpartDataSeries(true);
            List <IComparable> list = new List <IComparable>();

            if (counterpartDataSeries.Count == 1 && !this.ActualIsHundredPercent)
            {
                return(base.GetActualYDataRange());
            }
            foreach (XYDataPoint xyDataPoint in (Collection <DataPoint>) this.DataPoints)
            {
                if (xyDataPoint.YValue != null)
                {
                    object xValue             = ValueHelper.ConvertValue(xyDataPoint.XValue, this.ActualXValueType);
                    Range <IComparable> range = columnSeriesPresenter.GetDataPointYValueRange(xValue, counterpartDataSeries);
                    if (range.HasData)
                    {
                        range = columnSeriesPresenter.ConvertToPercentRange(range);
                        list.Add(range.Minimum);
                        list.Add(range.Maximum);
                    }
                }
            }
            return(RangeEnumerableExtensions.GetRange <IComparable>((IEnumerable <IComparable>)list));
        }
Exemplo n.º 2
0
        internal Range <IComparable> GetDataPointYValueRange(XYDataPoint p)
        {
            object index = ValueHelper.ConvertValue(p.XValue, this.Series.ActualXValueType);
            Range <IComparable> pointYvalueRange;

            if (!this.DataPointsByXValueRanges.TryGetValue(index, out pointYvalueRange))
            {
                pointYvalueRange = this.GetDataPointYValueRange(index, this.GetCounterpartDataSeries(true));
                this.DataPointsByXValueRanges[index] = pointYvalueRange;
            }
            return(pointYvalueRange);
        }
Exemplo n.º 3
0
        private void AddDataPointsByXValue(IEnumerable <DataPoint> dataPoints)
        {
            if (this._dataPointsByXValue == null)
            {
                this._dataPointsByXValue = new OrderedMultipleDictionary <object, DataPoint>(this.GetXValueKeyComparison());
            }
            DataValueType actualXvalueType = this.ActualXValueType;

            foreach (XYDataPoint xyDataPoint in dataPoints)
            {
                this._dataPointsByXValue.Add(ValueHelper.ConvertValue(xyDataPoint.XValue, actualXvalueType), (DataPoint)xyDataPoint);
            }
        }
Exemplo n.º 4
0
        private double TransformYValueInScaleUnits(XYDataPoint dataPoint, double yValueInScaleUnits)
        {
            if (!this.IsHundredPercent(dataPoint))
            {
                return(yValueInScaleUnits);
            }
            Range <IComparable> pointYvalueRange = this.GetDataPointYValueRange(dataPoint);
            double       val2         = (double)ValueHelper.ConvertValue((object)pointYvalueRange.Minimum, DataValueType.Float);
            double       num          = Math.Max(0.0, (double)ValueHelper.ConvertValue((object)pointYvalueRange.Maximum, DataValueType.Float)) - Math.Min(0.0, val2);
            NumericScale numericScale = this.Series.YAxis.Scale as NumericScale;

            if (num == 0.0)
            {
                return(this.Series.YAxis.Scale.ProjectDataValue(this.Series.YAxis.Scale.ActualCrossingPosition));
            }
            Range <double> fromRange   = new Range <double>(numericScale.Project(0.0), numericScale.Project(num));
            Range <double> targetRange = new Range <double>(numericScale.Project(0.0), numericScale.Project(1.0));

            return(RangeHelper.Project(fromRange, yValueInScaleUnits, targetRange));
        }
Exemplo n.º 5
0
        internal override void OnDataPointValueChanged(DataPoint dataPoint, string propertyName, object oldValue, object newValue)
        {
            base.OnDataPointValueChanged(dataPoint, propertyName, oldValue, newValue);
            if (!(dataPoint is XYDataPoint))
            {
                return;
            }
            switch (propertyName)
            {
            case "XValue":
                this.DataPointsByXValue.Remove(dataPoint);
                this.DataPointsByXValue.Add(ValueHelper.ConvertValue(newValue, this.ActualXValueType), dataPoint);
                this.UpdateActualXDataRange();
                break;

            case "YValue":
                this.UpdateActualYDataRange();
                break;
            }
        }
Exemplo n.º 6
0
        protected override void OnSeriesDataPointValueChanged(DataPoint dataPoint, string valueName, object oldValue, object newValue)
        {
            object obj  = (object)null;
            bool   flag = false;

            switch (valueName)
            {
            case "XValue":
                obj  = ValueHelper.ConvertValue(oldValue, this.Series.ActualXValueType);
                flag = true;
                break;

            case "YValue":
                obj = ValueHelper.ConvertValue(((XYDataPoint)dataPoint).XValue, this.Series.ActualXValueType);
                break;

            case "YValueInScaleUnits":
                if (this.ChartArea != null && this.ChartArea.IsTemplateApplied)
                {
                    obj = ValueHelper.ConvertValue(((XYDataPoint)dataPoint).XValue, this.Series.ActualXValueType);
                    if (!this._suppressCounterpartInvalidationFlag)
                    {
                        EnumerableFunctions.ForEach <XYDataPoint>(Enumerable.Where <XYDataPoint>((IEnumerable <XYDataPoint>) this.GetCounterpartDataPoints(obj, true), (Func <XYDataPoint, bool>)(p => p != dataPoint)), (Action <XYDataPoint>)(p => p.Update()));
                        break;
                    }
                    break;
                }
                break;
            }
            if (obj != null && this.ChartArea != null)
            {
                this.DataPointsByXValueRanges.Remove(obj);
            }
            if (flag && this.ChartArea != null && (!this.ChartArea.IsDirty && !this.ChartArea.UpdateSession.IsUpdating))
            {
                this.ChartArea.Invalidate();
            }
            base.OnSeriesDataPointValueChanged(dataPoint, valueName, oldValue, newValue);
        }
Exemplo n.º 7
0
        internal override double GetYOffsetInAxisUnits(XYDataPoint dataPoint, Point valuePoint, Point basePoint)
        {
            object xValue          = ValueHelper.ConvertValue(dataPoint.XValue, ((XYSeries)dataPoint.Series).ActualXValueType);
            bool   flag            = valuePoint.Y < basePoint.Y;
            double num1            = 0.0;
            double num2            = 0.0;
            object clusterGroupKey = ((ColumnSeries)this.Series).ClusterGroupKey;

            foreach (XYDataPoint dataPointXY in Enumerable.Where <XYDataPoint>((IEnumerable <XYDataPoint>) this.GetCounterpartDataPoints(xValue, false), (Func <XYDataPoint, bool>)(p => this.IsDataPointViewVisible((DataPoint)p))))
            {
                ColumnSeries columnSeries = dataPointXY.Series as ColumnSeries;
                if (clusterGroupKey != null && columnSeries != null)
                {
                    if (ValueHelper.AreEqual(columnSeries.ClusterGroupKey, clusterGroupKey))
                    {
                        break;
                    }
                }
                Point positionInAxisUnits = this.GetPositionInAxisUnits(dataPointXY);
                if (flag)
                {
                    if (positionInAxisUnits.Y < basePoint.Y)
                    {
                        num1 += basePoint.Y - positionInAxisUnits.Y;
                    }
                }
                else if (positionInAxisUnits.Y > basePoint.Y)
                {
                    num2 += basePoint.Y - positionInAxisUnits.Y;
                }
            }
            if (!flag)
            {
                return(num2);
            }
            return(num1);
        }
Exemplo n.º 8
0
        internal Range <IComparable> GetDataPointYValueRange(object xValue, List <XYSeries> series)
        {
            if (this.Series.ActualYValueType == DataValueType.Auto)
            {
                return(Range <IComparable> .Empty);
            }
            List <IComparable> list = new List <IComparable>();
            object             obj  = new object();
            Dictionary <object, List <IComparable> > dictionary = new Dictionary <object, List <IComparable> >();
            object index1 = ValueHelper.ConvertValue(xValue, this.Series.ActualXValueType);

            foreach (ColumnSeries columnSeries in Enumerable.OfType <ColumnSeries>((IEnumerable)series))
            {
                foreach (XYDataPoint xyDataPoint in columnSeries.DataPointsByXValue[index1])
                {
                    if (xyDataPoint.YValue != null)
                    {
                        IComparable comparable = ValueHelper.ConvertValue(xyDataPoint.YValue, this.Series.ActualYValueType) as IComparable;
                        object      key        = columnSeries.ClusterGroupKey ?? obj;
                        if (!dictionary.ContainsKey(key))
                        {
                            dictionary[key] = new List <IComparable>((IEnumerable <IComparable>) new IComparable[1]
                            {
                                comparable
                            });
                        }
                        else
                        {
                            dictionary[key].Add(comparable);
                        }
                    }
                }
            }
            IComparable comparable1 = (IComparable)null;
            IComparable comparable2 = (IComparable)null;
            IComparable comparable3 = ValueHelper.ConvertValue((this.Series.YAxis == null || this.Series.YAxis.Scale == null ? (object)0.0 : this.Series.YAxis.Scale.ActualCrossingPosition) ?? (object)0.0, this.Series.ActualYValueType) as IComparable;

            list.Add(comparable3);
            foreach (object index2 in dictionary.Keys)
            {
                if (index2 == obj)
                {
                    IComparable comparable4 = (IComparable)null;
                    IComparable comparable5 = (IComparable)null;
                    foreach (IComparable comparable6 in dictionary[index2])
                    {
                        if (comparable6.CompareTo((object)comparable3) > 0)
                        {
                            comparable4 = comparable4 == null ? comparable6 : ValueHelper.AddComparableValues(comparable4, comparable6);
                        }
                        else
                        {
                            comparable5 = comparable5 == null ? comparable6 : ValueHelper.AddComparableValues(comparable5, comparable6);
                        }
                    }
                    if (comparable4 != null)
                    {
                        list.Add(comparable4);
                    }
                    if (comparable5 != null)
                    {
                        list.Add(comparable5);
                    }
                }
                else
                {
                    Range <IComparable> range = RangeEnumerableExtensions.GetRange <IComparable>((IEnumerable <IComparable>)dictionary[index2]);
                    if (range.HasData)
                    {
                        IComparable comparable4 = range.Minimum;
                        IComparable comparable5 = range.Maximum;
                        IComparable comparable6 = comparable3;
                        if (comparable6.GetType() != comparable4.GetType())
                        {
                            comparable6 = Convert.ChangeType((object)comparable6, comparable4.GetType(), (IFormatProvider)CultureInfo.InvariantCulture) as IComparable;
                        }
                        if (comparable4.CompareTo((object)comparable6) > 0)
                        {
                            comparable4 = comparable6;
                        }
                        if (comparable5.CompareTo((object)comparable6) < 0)
                        {
                            comparable5 = comparable6;
                        }
                        comparable1 = comparable1 == null ? comparable5 : ValueHelper.AddComparableValues(comparable1, comparable5);
                        comparable2 = comparable2 == null ? comparable4 : ValueHelper.AddComparableValues(comparable2, comparable4);
                        if (comparable1 != null)
                        {
                            list.Add(ValueHelper.ConvertValue((object)comparable1, this.Series.ActualYValueType) as IComparable);
                        }
                        if (comparable2 != null)
                        {
                            list.Add(ValueHelper.ConvertValue((object)comparable2, this.Series.ActualYValueType) as IComparable);
                        }
                    }
                }
            }
            return(RangeEnumerableExtensions.GetRange <IComparable>((IEnumerable <IComparable>)list));
        }
Exemplo n.º 9
0
 private IEnumerable <object> GetYValues()
 {
     return(Enumerable.Distinct <object>(Enumerable.Select <XYDataPoint, object>(Enumerable.OfType <XYDataPoint>((IEnumerable)this.DataPoints), (Func <XYDataPoint, object>)(item => ValueHelper.ConvertValue(item.YValue, this.YValueType)))));
 }