Ejemplo n.º 1
0
        private void PrepareOppositeAxisLine()
        {
            if (this.OppositeAxisLine == null || this.Axis == null || this.Axis.Scale == null)
            {
                return;
            }
            this.OppositeAxisLine.X2 = this.OppositeAxisLine.Y2 = 0.0;
            if (this.Orientation == Orientation.Horizontal)
            {
                this.OppositeAxisLine.Y2 = 1.0;
            }
            else
            {
                this.OppositeAxisLine.X2 = 1.0;
            }
            double num = this.Axis.Scale.ProjectDataValue(this.Axis.Scale.ActualCrossingPosition);

            if (DoubleHelper.GreaterOrEqualWithPrecision(num, 0.0) && DoubleHelper.LessOrEqualWithPrecision(num, 1.0))
            {
                this.UpdateAxisLineVisibility();
                XYAxisElementsPanel.SetCoordinate((UIElement)this.OppositeAxisLine, num);
            }
            else
            {
                this.OppositeAxisLine.Visibility = Visibility.Collapsed;
            }
        }
Ejemplo n.º 2
0
 internal virtual bool CanGraph(XYDataPoint dataPointXY)
 {
     if (ValueHelper.CanGraph(dataPointXY.XValueInScaleUnits) && ValueHelper.CanGraph(dataPointXY.YValueInScaleUnits) && (DoubleHelper.GreaterOrEqualWithPrecision(dataPointXY.XValueInScaleUnits, 0.0) && DoubleHelper.LessOrEqualWithPrecision(dataPointXY.XValueInScaleUnits, 1.0)) && DoubleHelper.GreaterOrEqualWithPrecision(dataPointXY.YValueInScaleUnits, 0.0))
     {
         return(DoubleHelper.LessOrEqualWithPrecision(dataPointXY.YValueInScaleUnits, 1.0));
     }
     return(false);
 }
Ejemplo n.º 3
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;
            }
        }
Ejemplo n.º 4
0
        internal override bool CanGraph(XYDataPoint dataPointXY)
        {
            BubbleDataPoint bubbleDataPoint = dataPointXY as BubbleDataPoint;

            if (bubbleDataPoint != null && this.BubbleSeries.IsSizeValueUsed && bubbleDataPoint.IsSizeValueUsed)
            {
                double doubleValue = 0.0;
                if (!ValueHelper.TryConvert(bubbleDataPoint.SizeValue, true, out doubleValue) || !ValueHelper.CanGraph(doubleValue) || DoubleHelper.LessOrEqualWithPrecision(bubbleDataPoint.SizeValueInScaleUnits, 0.0))
                {
                    return(false);
                }
            }
            return(base.CanGraph(dataPointXY));
        }
Ejemplo n.º 5
0
 protected override void Populate(double availableLength)
 {
     this._majorTickMarkPool.ReleaseAll();
     this._minorTickMarkPool.ReleaseAll();
     if (this.Presenter.IsMinorTickMarksVisible)
     {
         this._majorTickMarkPool.AdjustPoolSize();
     }
     try
     {
         this.PrepareAxisLine();
         this.PrepareScrollBar();
         if (!this.Axis.ShowMajorTickMarks && !this.Presenter.IsMinorTickMarksVisible)
         {
             return;
         }
         foreach (ScaleElementDefinition elementDefinition in (IEnumerable <ScaleElementDefinition>) new List <ScaleElementDefinition>((IEnumerable <ScaleElementDefinition>)Enumerable.OrderBy <ScaleElementDefinition, int>(Enumerable.Where <ScaleElementDefinition>(this.Presenter.GetScaleElements(), (Func <ScaleElementDefinition, bool>)(p => p.Kind == ScaleElementKind.Tickmark)), (Func <ScaleElementDefinition, int>)(p => p.Group != ScaleElementGroup.Major ? 0 : 1))))
         {
             if (elementDefinition.Group == ScaleElementGroup.Major && this.Axis.ShowMajorTickMarks && !this.LabelsUseCategoryTickmarks)
             {
                 EnumerableFunctions.ForEachWithIndex <ScalePosition>(Enumerable.Where <ScalePosition>(elementDefinition.Positions, (Func <ScalePosition, bool>)(p =>
                 {
                     if (p.Position >= 0.0)
                     {
                         return(p.Position <= 1.0);
                     }
                     return(false);
                 })), (Action <ScalePosition, int>)((position, index) =>
                 {
                     RotatableControl rotatableControl = this._majorTickMarkPool.Get(this.Axis);
                     XYAxisElementsPanel.SetCoordinate((UIElement)rotatableControl, position.Position);
                     XYAxisElementsPanel.SetPosition((UIElement)rotatableControl, ((TickMark)rotatableControl.Child).Position);
                 }));
             }
             if (elementDefinition.Group == ScaleElementGroup.Minor && this.Presenter.IsMinorTickMarksVisible)
             {
                 EnumerableFunctions.ForEachWithIndex <ScalePosition>(Enumerable.Where <ScalePosition>(elementDefinition.Positions, (Func <ScalePosition, bool>)(p =>
                 {
                     if (DoubleHelper.GreaterOrEqualWithPrecision(p.Position, 0.0))
                     {
                         return(DoubleHelper.LessOrEqualWithPrecision(p.Position, 1.0));
                     }
                     return(false);
                 })), (Action <ScalePosition, int>)((position, index) =>
                 {
                     RotatableControl rotatableControl = this._minorTickMarkPool.Get(this.Axis);
                     XYAxisElementsPanel.SetCoordinate((UIElement)rotatableControl, position.Position);
                     XYAxisElementsPanel.SetPosition((UIElement)rotatableControl, ((TickMark)rotatableControl.Child).Position);
                 }));
             }
         }
     }
     finally
     {
         if (!this.Presenter.IsMinorTickMarksVisible)
         {
             this._majorTickMarkPool.AdjustPoolSize();
         }
         this._minorTickMarkPool.AdjustPoolSize();
     }
 }