// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace System.Windows.Controls.DataVisualization.Charting
{
///
/// This series serves as the base class for the column and bar series.
///
/// The type of the data point.
public abstract class ColumnBarBaseSeries : DataPointSingleSeriesWithAxes, IAnchoredToOrigin
where T : DataPoint, new()
{
#region public IRangeAxis DependentRangeAxis
///
/// Gets or sets the dependent range axis.
///
public IRangeAxis DependentRangeAxis
{
get { return GetValue(DependentRangeAxisProperty) as IRangeAxis; }
set { SetValue(DependentRangeAxisProperty, value); }
}
///
/// Identifies the DependentRangeAxis dependency property.
///
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes", Justification = "This member is necessary because child classes need to share this dependency property.")]
public static readonly DependencyProperty DependentRangeAxisProperty =
DependencyProperty.Register(
"DependentRangeAxis",
typeof(IRangeAxis),
typeof(ColumnBarBaseSeries),
new PropertyMetadata(null, OnDependentRangeAxisPropertyChanged));
///
/// DependentRangeAxisProperty property changed handler.
///
/// ColumnBarBaseSeries that changed its DependentRangeAxis.
/// Event arguments.
private static void OnDependentRangeAxisPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ColumnBarBaseSeries source = (ColumnBarBaseSeries)d;
IRangeAxis newValue = (IRangeAxis)e.NewValue;
source.OnDependentRangeAxisPropertyChanged(newValue);
}
///
/// DependentRangeAxisProperty property changed handler.
///
/// New value.
private void OnDependentRangeAxisPropertyChanged(IRangeAxis newValue)
{
InternalDependentAxis = (IAxis)newValue;
}
#endregion public IRangeAxis DependentRangeAxis
#region public IAxis IndependentAxis
///
/// Gets or sets the independent category axis.
///
public IAxis IndependentAxis
{
get { return GetValue(IndependentAxisProperty) as IAxis; }
set { SetValue(IndependentAxisProperty, value); }
}
///
/// Identifies the IndependentAxis dependency property.
///
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes", Justification = "This member is necessary because child classes need to share this dependency property.")]
public static readonly DependencyProperty IndependentAxisProperty =
DependencyProperty.Register(
"IndependentAxis",
typeof(IAxis),
typeof(ColumnBarBaseSeries),
new PropertyMetadata(null, OnIndependentAxisPropertyChanged));
///
/// IndependentAxisProperty property changed handler.
///
/// ColumnBarBaseSeries that changed its IndependentAxis.
/// Event arguments.
private static void OnIndependentAxisPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ColumnBarBaseSeries source = (ColumnBarBaseSeries)d;
IAxis newValue = (IAxis)e.NewValue;
source.OnIndependentAxisPropertyChanged(newValue);
}
///
/// IndependentAxisProperty property changed handler.
///
/// New value.
private void OnIndependentAxisPropertyChanged(IAxis newValue)
{
InternalIndependentAxis = (IAxis)newValue;
}
#endregion public IAxis IndependentAxis
///
/// Keeps a list of DataPoints that share the same category.
///
private IDictionary