/// <summary>
 /// Handles the StateChanged event of a DataPoint.
 /// </summary>
 /// <param name="sender">Event source.</param>
 /// <param name="e">Event arguments.</param>
 private void DataPointStateChanged(object sender, RoutedPropertyChangedEventArgs<DataPointState> e)
 {
     DataPoint dataPoint = (DataPoint)sender;
     if ((int)DataPointState.Hidden == dataPoint.State)
     {
         DataItems.Remove(DataItems.Where(di => di.DataPoint == dataPoint).Single());
         RemovedDataItems();
     }
 }
 /// <summary>
 /// Handles the IndependentValueChanged event of a DataPoint.
 /// </summary>
 /// <param name="sender">Event source.</param>
 /// <param name="e">Event arguments.</param>
 private void DataPointIndependentValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
 {
     DataPoint dataPoint = (DataPoint)sender;
     SeriesDefinition definition = DataItemFromDataPoint(dataPoint).SeriesDefinition;
     TimeSpan transitionDuration = definition.TransitionDuration;
     if (0 < transitionDuration.TotalMilliseconds)
     {
         dataPoint.BeginAnimation(DataPoint.ActualIndependentValueProperty, "ActualIndependentValue", e.NewValue, definition.TransitionDuration, definition.TransitionEasingFunction);
     }
     else
     {
         dataPoint.ActualIndependentValue = e.NewValue;
     }
 }
 /// <summary>
 /// Handles the ActualIndependentValueChanged event of a DataPoint.
 /// </summary>
 /// <param name="sender">Event source.</param>
 /// <param name="e">Event arguments.</param>
 private void DataPointActualIndependentValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
 {
     DataPoint dataPoint = (DataPoint)sender;
     QueueUpdateDataItemPlacement(false, true, DataItems.Where(di => di.DataPoint == dataPoint));
 }
 /// <summary>
 /// Updates the data point when the pie data point's actual offset ratio
 /// is changed.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">Information about the event.</param>
 private void OnPieDataPointActualOffsetRatioChanged(object sender, RoutedPropertyChangedEventArgs<double> args)
 {
     UpdateDataPoint(sender as DataPoint);
 }
 /// <summary>
 /// Updates the data point when the pie data point's offset ratio is 
 /// changed.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">Information about the event.</param>
 private void OnPieDataPointOffsetRatioChanged(object sender, RoutedPropertyChangedEventArgs<double> args)
 {
     DataPoint dataPoint = sender as DataPoint;
     dataPoint.BeginAnimation(PieDataPoint.ActualOffsetRatioProperty, "ActualOffsetRatio", args.NewValue, TransitionDuration, this.TransitionEasingFunction);
 }
 /// <summary>
 /// Handles data point actual dependent value property changes.
 /// </summary>
 /// <param name="sender">The data point.</param>
 /// <param name="args">Information about the event.</param>
 private void OnDataPointActualDependentValueChanged(object sender, RoutedPropertyChangedEventArgs<IComparable> args)
 {
     OnDataPointActualDependentValueChanged(sender as DataPoint, args.OldValue, args.NewValue);
 }
 /// <summary>
 /// Handles data point independent value property changes.
 /// </summary>
 /// <param name="sender">The data point.</param>
 /// <param name="args">Information about the event.</param>
 private void OnDataPointIndependentValueChanged(object sender, RoutedPropertyChangedEventArgs<object> args)
 {
     OnDataPointIndependentValueChanged(sender as DataPoint, args.OldValue, args.NewValue);
 }
        /// <summary>
        /// Method executed when a data point is either selected or unselected.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Information about the event.</param>
        private void OnDataPointIsSelectedChanged(object sender, RoutedPropertyChangedEventArgs<bool> e)
        {
            DataPoint dataPoint = sender as DataPoint;

            if (e.NewValue)
            {
                Select(dataPoint);
            }
            else
            {
                Unselect(dataPoint);
            }
        }
Example #9
0
        /// <summary>
        /// Rebuild the chart area if an axis location is changed.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Information about the event.</param>
        private void AxisLocationChanged(object sender, RoutedPropertyChangedEventArgs<AxisLocation> args)
        {
            Axis axis = (Axis)sender;

            if (args.NewValue == AxisLocation.Auto)
            {
                throw new InvalidOperationException(Properties.Resources.Chart_AxisLocationChanged_CantBeChangedToAutoWhenHostedInsideOfASeriesHost);
            }

            SetEdge(axis);

            _edgeAxes.Remove(axis);
            _edgeAxes.Add(axis);
        }
Example #10
0
        /// <summary>
        /// Rebuilds the chart area if an axis orientation is changed.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Information about the event.</param>
        private void AxisOrientationChanged(object sender, RoutedPropertyChangedEventArgs<AxisOrientation> args)
        {
            Axis axis = (Axis)sender;

            axis.Location = GetAutoAxisLocation(axis);
        }
        /// <summary>
        /// Animates the value of the ActualSize property to the size property
        /// when it changes.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Information about the event.</param>
        private void BubbleDataPointSizePropertyChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            BubbleDataPoint dataPoint = (BubbleDataPoint)sender;

            DependencyPropertyAnimationHelper.BeginAnimation(
                dataPoint, 
                BubbleDataPoint.ActualSizeProperty, 
                "ActualSize", 
                e.NewValue, 
                TransitionDuration, 
                this.TransitionEasingFunction);
        }
 /// <summary>
 /// Updates all data points when the actual size property of a data 
 /// point changes.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">Information about the event.</param>
 private void BubbleDataPointActualSizePropertyChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
 {
     Range<double> newRangeOfActualSizeValues = ActiveDataPoints.OfType<BubbleDataPoint>().Select(d => Math.Abs(d.ActualSize)).GetRange();
     if (newRangeOfActualSizeValues == _rangeOfActualSizeValues)
     {
         // No range change - only need to update the current point
         UpdateDataPoint((BubbleDataPoint)sender);
     }
     else
     {
         // Range has changed - need to update all points
         UpdateDataPoints(ActiveDataPoints);
     }
 }