Esempio n. 1
0
        internal bool ShouldSimplifiedRenderingModeBeEnabled()
        {
            int num = this.Series.SimplifiedRenderingThreshold ?? this.DefaultSimplifiedRenderingThreshold;

            if (num == 0)
            {
                return(true);
            }
            if (this.Series.DataPoints.Count >= num)
            {
                return(EnumerableFunctions.FastCount((IEnumerable)this.VisibleDataPoints) >= num);
            }
            return(false);
        }
Esempio n. 2
0
        internal override void UpdateDataPointVisibility()
        {
            int  index1 = 0;
            bool flag1  = true;
            bool flag2  = true;

            DataPointViewState[] dataPointViewStateArray = new DataPointViewState[this.Series.DataPoints.Count];
            foreach (DataPoint dataPoint1 in (Collection <DataPoint>) this.Series.DataPoints)
            {
                DataPointViewState dataPointViewState = DataPointViewState.Hidden;
                dataPoint1.IsVisible = false;
                XYDataPoint xyDataPoint = dataPoint1 as XYDataPoint;
                if (xyDataPoint != null && this.ChartArea != null && (this.ChartArea.IsTemplateApplied && ValueHelper.CanGraph(xyDataPoint.XValueInScaleUnits)) && ValueHelper.CanGraph(xyDataPoint.YValueInScaleUnits))
                {
                    if (DoubleHelper.GreaterOrEqualWithPrecision(xyDataPoint.XValueInScaleUnits, 0.0) && DoubleHelper.LessOrEqualWithPrecision(xyDataPoint.XValueInScaleUnits, 1.0) && (DoubleHelper.GreaterOrEqualWithPrecision(xyDataPoint.YValueInScaleUnits, 0.0) && DoubleHelper.LessOrEqualWithPrecision(xyDataPoint.YValueInScaleUnits, 1.0)))
                    {
                        if (this.Series.Visibility == Visibility.Visible)
                        {
                            flag1 = false;
                            dataPoint1.IsVisible = true;
                            if (!dataPoint1.IsNewlyAdded)
                            {
                                flag2 = false;
                            }
                            dataPointViewState = dataPoint1.IsNewlyAdded ? DataPointViewState.Showing : DataPointViewState.Normal;
                            if (index1 > 0)
                            {
                                DataPoint dataPoint2 = this.Series.DataPoints[index1 - 1];
                                if (dataPointViewStateArray[index1 - 1] == DataPointViewState.Hidden || dataPointViewStateArray[index1 - 1] == DataPointViewState.Hiding)
                                {
                                    dataPoint2.IsVisible = true;
                                    dataPointViewStateArray[index1 - 1] = dataPointViewState;
                                    this.ChartArea.UpdateSession.Update((IUpdatable)dataPoint2);
                                }
                            }
                            if (index1 < this.Series.DataPoints.Count - 1)
                            {
                                DataPoint dataPoint2 = this.Series.DataPoints[index1 + 1];
                                if (!this._dataPointsToForceVisibility.Contains(dataPoint2))
                                {
                                    this._dataPointsToForceVisibility.Add(dataPoint2);
                                }
                            }
                            this.ChartArea.UpdateSession.Update((IUpdatable)dataPoint1);
                        }
                    }
                    else if (this._dataPointsToForceVisibility.Contains(dataPoint1))
                    {
                        dataPoint1.IsVisible = true;
                        dataPointViewState   = dataPoint1.IsNewlyAdded ? DataPointViewState.Showing : DataPointViewState.Normal;
                    }
                }
                if (this._dataPointsToForceVisibility.Contains(dataPoint1))
                {
                    this._dataPointsToForceVisibility.Remove(dataPoint1);
                }
                dataPointViewStateArray[index1] = dataPointViewState;
                ++index1;
            }
            this.IsSimplifiedRenderingModeCheckRequired = true;
            this.CheckSimplifiedRenderingMode();
            if (!flag2)
            {
                for (int index2 = 0; index2 < EnumerableFunctions.FastCount((IEnumerable)dataPointViewStateArray); ++index2)
                {
                    if (dataPointViewStateArray[index2] == DataPointViewState.Showing)
                    {
                        dataPointViewStateArray[index2] = DataPointViewState.Normal;
                    }
                }
            }
            if (flag1 && this.Series.DataPoints.Count > 0 && (this.ChartArea != null && this.ChartArea.IsTemplateApplied) && (DoubleHelper.LessWithPrecision(((XYDataPoint)this.Series.DataPoints[0]).XValueInScaleUnits, 0.0) && DoubleHelper.GreaterWithPrecision(((XYDataPoint)this.Series.DataPoints[this.Series.DataPoints.Count - 1]).XValueInScaleUnits, 1.0)))
            {
                int index2;
                for (index2 = 1; index2 < this.Series.DataPoints.Count - 2; ++index2)
                {
                    if (DoubleHelper.GreaterOrEqualWithPrecision((this.Series.DataPoints[index2] as XYDataPoint).XValueInScaleUnits, 0.0))
                    {
                        --index2;
                        break;
                    }
                }
                XYDataPoint xyDataPoint1 = this.Series.DataPoints[index2] as XYDataPoint;
                xyDataPoint1.IsVisible          = true;
                dataPointViewStateArray[index2] = xyDataPoint1.IsNewlyAdded ? DataPointViewState.Showing : DataPointViewState.Normal;
                this.ChartArea.UpdateSession.Update((IUpdatable)xyDataPoint1);
                XYDataPoint xyDataPoint2 = this.Series.DataPoints[index2 + 1] as XYDataPoint;
                xyDataPoint2.IsVisible = true;
                dataPointViewStateArray[index2 + 1] = xyDataPoint2.IsNewlyAdded ? DataPointViewState.Showing : DataPointViewState.Normal;
                this.ChartArea.UpdateSession.Update((IUpdatable)xyDataPoint2);
            }
            int index3 = 0;

            foreach (DataPoint dataPoint in (Collection <DataPoint>) this.Series.DataPoints)
            {
                this.SetDataPointViewState(dataPoint, dataPointViewStateArray[index3]);
                dataPoint.IsNewlyAdded = false;
                ++index3;
            }
        }