Beispiel #1
0
        private static void OnDoughnutSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var series = d as DoughnutSeries;

            series.InternalDoughnutSize = ChartMath.MinMax((double)e.NewValue, 0, 1);
            series.UpdateArea();
        }
Beispiel #2
0
        private static void OnPieCoefficientPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var series = d as PieSeries;

            series.InternalPieCoefficient = ChartMath.MinMax((double)e.NewValue, 0, 1);
            series.UpdateArea();
        }
Beispiel #3
0
        /// <summary>
        /// Updates the series when doughnut coefficient changed.
        /// </summary>
        /// <param name="d">The Dependency Object</param>
        /// <param name="e">The Event Arguments</param>
        private static void OnDoughnutCoefficientChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var doughnutSeries3D = d as DoughnutSeries3D;

            doughnutSeries3D.InternlDoughnutCoefficient = ChartMath.MinMax((double)e.NewValue, 0, 1);
            doughnutSeries3D.UpdateArea();
        }
Beispiel #4
0
        private static void OnDoughnutHoleSizeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var chartArea = sender as SfChart;

            if (chartArea != null)
            {
                chartArea.InternalDoughnutHoleSize = ChartMath.MinMax((double)e.NewValue, 0, 1);
                chartArea.ScheduleUpdate();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Updates the series when the circle coefficient changes.
        /// </summary>
        /// <param name="sender">The Sender</param>
        /// <param name="e">The Dependency Object</param>
        private static void OnCircleCoefficientChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var circularSeriesBase3D = sender as CircularSeriesBase3D;

            if (circularSeriesBase3D != null)
            {
                circularSeriesBase3D.InternalCircleCoefficient = ChartMath.MinMax((double)e.NewValue, 0, 1);
                circularSeriesBase3D.UpdateArea();
            }
        }
        /// <summary>
        /// Updates the <see cref="ZoomOut"/> icon.
        /// </summary>
        /// <param name="e">The Event Arguments</param>
        protected override void OnPointerPressed(PointerRoutedEventArgs e)
        {
            if (this.Source.ChartArea.AreaType != ChartAreaType.CartesianAxes)
            {
                return;
            }
            bool canZoom     = false;
            int  updatedAxes = 0;

            foreach (ChartAxisBase2D axis in this.Source.ChartArea.Axes)
            {
                if (axis.RegisteredSeries.Count > 0 && (axis.RegisteredSeries[0] as CartesianSeries) != null && (axis.RegisteredSeries[0] as CartesianSeries).IsActualTransposed)
                {
                    if ((axis.Orientation == Orientation.Horizontal && (Source.ZoomMode == ZoomMode.Y || Source.ZoomMode == ZoomMode.XY)) ||
                        (axis.Orientation == Orientation.Vertical && (Source.ZoomMode == ZoomMode.X || Source.ZoomMode == ZoomMode.XY)))
                    {
                        canZoom = true;
                    }
                }
                else
                {
                    if ((axis.Orientation == Orientation.Vertical && (Source.ZoomMode == ZoomMode.Y || Source.ZoomMode == ZoomMode.XY)) ||
                        (axis.Orientation == Orientation.Horizontal && (Source.ZoomMode == ZoomMode.X || Source.ZoomMode == ZoomMode.XY)))
                    {
                        canZoom = true;
                    }
                }

                if (canZoom)
                {
                    var    origin          = 0.5;
                    double currentScale    = Math.Max(1 / ChartMath.MinMax(axis.ZoomFactor, 0, 1), 1);
                    double cumulativeScale = Math.Max(currentScale + (0.25 * -1), 1);
                    Source.Zoom(cumulativeScale, origin > 1d ? 1d : origin < 0d ? 0d : origin, axis);
                }

                canZoom = false;
                if (axis.ZoomFactor == 1 || axis.ZoomPosition == 0)
                {
                    updatedAxes++;
                }
            }

            e.Handled = true;
        }