示例#1
0
        public static void Animate3D(SfChart3D chart)
        {
            var sb = new Storyboard();

            DoubleAnimation animation = new DoubleAnimation()
            {
                From = 0, To = chart.Rotation,
            };

            Storyboard.SetTarget(animation, chart);
            Storyboard.SetTargetProperty(animation, new PropertyPath(SfChart3D.RotationProperty));

            sb.Children.Add(animation);

            animation = new DoubleAnimation()
            {
                From = 0, To = chart.Tilt,
            };
            Storyboard.SetTarget(animation, chart);
            Storyboard.SetTargetProperty(animation, new PropertyPath(SfChart3D.TiltProperty));
            sb.Children.Add(animation);

            EventHandler handler = (object sender, EventArgs e) =>
            {
                var rotation = chart.Rotation;
                var tilt     = chart.Tilt;
                chart.BeginAnimation(SfChart3D.RotationProperty, null);
                chart.BeginAnimation(SfChart3D.TiltProperty, null);
                chart.Rotation = rotation;
                chart.Tilt     = tilt;
            };

            sb.Completed += handler;
            sb.Begin();
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PieSegment3D"/> class.
        /// </summary>
        /// <param name="series">The series.</param>
        /// <param name="center">The center.</param>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <param name="height">The height.</param>
        /// <param name="r">The r.</param>
        /// <param name="i">The i.</param>
        /// <param name="y">The y.</param>
        /// <param name="insideRadius">The inside radius.</param>
        public PieSegment3D(ChartSeries3D series, Vector3D center, double start, double end, double height, double r, int i, double y, double insideRadius)
        {
            Points = new List <Point>();

            if (series.ToggledLegendIndex.Contains(i))
            {
                this.IsSegmentVisible = false;
            }
            else
            {
                this.IsSegmentVisible = true;
            }
            Series     = series3D = series as PieSeries3D;
            area       = series.Area;
            Item       = series.ActualData[i];
            StartValue = start;
            EndValue   = end;
            depth      = height;
            radius     = r;
            if (series3D != null)
            {
                pieIndex = series3D.GetPieSeriesIndex();
            }

            Index        = i;
            YData        = y;
            Center       = center;
            inSideRadius = insideRadius;
            if (series.CanAnimate)
            {
                return;
            }
            if (series3D.StartAngle < series3D.EndAngle)
            {
                ActualStartValue = start;
                ActualEndValue   = end - start;
            }
            else
            {
                ActualStartValue = end;
                ActualEndValue   = start - end;
            }
        }
示例#3
0
        /// <summary>
        /// Updates the <see cref="ChartSeries3D"/> on mouse down selection.
        /// </summary>
        /// <param name="currentIndex">The Current Selected Index</param>
        internal void OnMouseDownSelection(int currentIndex)
        {
            bool seriesSelection = this.Area.EnableSeriesSelection &&
                                   (IsSideBySide || this is ScatterSeries3D ||
                                    this is CircularSeriesBase3D ||
                                    (!this.IsSideBySide &&
                                     ((!this.Area.EnableSegmentSelection) ||
                                      (this.Area.EnableSegmentSelection && currentIndex == -1))));

            if (seriesSelection)
            {
                int index = this.Area.Series.IndexOf(this as ChartSeries3D);
                selectionChangingEventArgs.IsDataPointSelection = false;
                bool isCancel = this.RaiseSelectionChanging(index, this.Area.SeriesSelectedIndex);

                if (!isCancel)
                {
                    if (this.Area.SelectionStyle != SelectionStyle3D.Single && this.Area.SelectedSeriesCollection.Contains(this))
                    {
                        this.Area.SelectedSeriesCollection.Remove(this);

                        if (this.Area.SeriesSelectedIndex == index)
                        {
                            this.Area.SeriesSelectedIndex = -1;
                        }

                        SfChart3D.OnResetSeries(this);
                    }
                    else if (this.Area.SeriesSelectedIndex == index)
                    {
                        this.Area.SeriesSelectedIndex = -1;
                    }
                    else if (index > -1)
                    {
                        this.Area.SeriesSelectedIndex    = index;
                        this.Area.PreviousSelectedSeries = this;
                    }
                }
            }
            else if (this.Area.EnableSegmentSelection)
            {
                selectionChangingEventArgs.IsDataPointSelection = true;
                bool isCancel = this.RaiseSelectionChanging(currentIndex, this.SelectedIndex);

                if (!isCancel)
                {
                    if (this.Area.SelectionStyle != SelectionStyle3D.Single && SelectedSegmentsIndexes.Contains(currentIndex))
                    {
                        SelectedSegmentsIndexes.Remove(currentIndex);

                        if (this.SelectedIndex == currentIndex)
                        {
                            this.SelectedIndex = -1;
                        }

                        this.OnResetSegment(currentIndex);
                    }
                    else if (this.SelectedIndex == currentIndex)
                    {
                        this.SelectedIndex = -1;
                    }
                    else if (currentIndex > -1)
                    {
                        this.SelectedIndex = currentIndex;
                        this.Area.PreviousSelectedSeries = this;
                    }
                }
            }
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AreaSegment3D"/> class.
 /// </summary>
 /// <param name="xValues">The X Values</param>
 /// <param name="YValues">The Y Values</param>
 /// <param name="startDepth">The Start Depth</param>
 /// <param name="endDepth">The End Depth</param>
 /// <param name="areaSeries3D">The AreaSeries 3D</param>
 public AreaSegment3D(List <double> xValues, IList <double> YValues, double startDepth, double endDepth, AreaSeries3D areaSeries3D)
 {
     this.Series = areaSeries3D;
     this.area   = areaSeries3D.Area;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LineSegment3D"/> class with default settings.
 /// </summary>
 /// <param name="xValues">The X Values</param>
 /// <param name="YValues">The Y Values</param>
 /// <param name="startDepth">The Start Depth</param>
 /// <param name="endDepth">The End Depth</param>
 /// <param name="lineSeries3D">The LineSeries3D</param>
 public LineSegment3D(List <double> xValues, IList <double> YValues, double startDepth, double endDepth, LineSeries3D lineSeries3D)
 {
     this.Series          = lineSeries3D;
     this.area            = lineSeries3D.Area;
     this.polygonRecycler = new PolygonRecycler();
 }