815 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			815 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.ComponentModel;
 | 
						|
using System.Drawing;
 | 
						|
using System.Drawing.Design;
 | 
						|
using System.Windows.Forms;
 | 
						|
using DevComponents.DotNetBar.Charts.Style;
 | 
						|
 | 
						|
namespace DevComponents.DotNetBar.Charts
 | 
						|
{
 | 
						|
    /// <summary>
 | 
						|
    /// Represents the collection of Axis Stripes.
 | 
						|
    /// </summary>
 | 
						|
    [Editor("DevComponents.Charts.Design.AxisStripeCollectionEditor, DevComponents.Charts.Design, " +
 | 
						|
        "Version=14.1.0.37, Culture=neutral,  PublicKeyToken=90f470f34c89ccaf", typeof(UITypeEditor))]
 | 
						|
    public class AxisStripeCollection : CustomNamedCollection<AxisStripe>
 | 
						|
    {
 | 
						|
        public AxisStripeCollection()
 | 
						|
        {
 | 
						|
        }
 | 
						|
 | 
						|
        #region GetUniqueName
 | 
						|
 | 
						|
        public string GetUniqueName()
 | 
						|
        {
 | 
						|
            return (GetUniqueName("Stripe"));
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Element describing a color stripe on the chart.  Each AxisStripe
 | 
						|
    /// is associated with a primary or Ancillary Axis.
 | 
						|
    /// </summary>
 | 
						|
    public class AxisStripe : ChartVisualElement, ILegendItem
 | 
						|
    {
 | 
						|
        #region Private variables
 | 
						|
 | 
						|
        private States _States;
 | 
						|
 | 
						|
        private object _MinValue;
 | 
						|
        private object _MaxValue;
 | 
						|
        private AxisStripeVisualStyle _AxisStripeVisualStyle;
 | 
						|
 | 
						|
        private string _LegendText;
 | 
						|
        private ChartLegendItem _LegendItem;
 | 
						|
        private ChartLegendItemVisualStyles _ChartLegendItemVisualStyles;
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Constructors
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Create a new AxisStripe.
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="name"></param>
 | 
						|
        /// <param name="minValue"></param>
 | 
						|
        /// <param name="maxValue"></param>
 | 
						|
        public AxisStripe(string name, object minValue, object maxValue)
 | 
						|
            : this()
 | 
						|
        {
 | 
						|
            Name = name;
 | 
						|
 | 
						|
            MinValue = minValue;
 | 
						|
            MaxValue = maxValue;
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Create a new AxisStripe.
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="name"></param>
 | 
						|
        public AxisStripe(string name)
 | 
						|
            : this()
 | 
						|
        {
 | 
						|
            Name = name;
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Create a new AxisStripe.
 | 
						|
        /// </summary>
 | 
						|
        public AxisStripe()
 | 
						|
        {
 | 
						|
            InitDefaultStates();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region InitDefaultStates
 | 
						|
 | 
						|
        private void InitDefaultStates()
 | 
						|
        {
 | 
						|
            SetState(States.CheckedInLegend, true);
 | 
						|
            SetState(States.ShowInLegend, true);
 | 
						|
            SetState(States.ShowInParentLegend, true);
 | 
						|
            SetState(States.ShowCheckBoxInLegend, true);
 | 
						|
            SetState(States.ShowMarkerInLegend, true);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Public properties
 | 
						|
 | 
						|
        #region AxisStripeVisualStyle
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the visual style for the AxisStripe.
 | 
						|
        /// </summary>
 | 
						|
        [Category("Style")]
 | 
						|
        [Description("Indicates the visual style for the AxisStripe.")]
 | 
						|
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
 | 
						|
        public AxisStripeVisualStyle AxisStripeVisualStyle
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                if (_AxisStripeVisualStyle == null)
 | 
						|
                {
 | 
						|
                    _AxisStripeVisualStyle = new AxisStripeVisualStyle();
 | 
						|
 | 
						|
                    StyleVisualChangeHandler(null, _AxisStripeVisualStyle);
 | 
						|
                }
 | 
						|
 | 
						|
                return (_AxisStripeVisualStyle);
 | 
						|
            }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_AxisStripeVisualStyle != value)
 | 
						|
                {
 | 
						|
                    AxisStripeVisualStyle oldValue = _AxisStripeVisualStyle;
 | 
						|
 | 
						|
                    _AxisStripeVisualStyle = value;
 | 
						|
 | 
						|
                    OnVisualStyleChanged("AxisStripeVisualStyle", oldValue, value);
 | 
						|
 | 
						|
                    if (oldValue != null)
 | 
						|
                        oldValue.Dispose();
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region IsDisplayed
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Gets whether the Stripe is displayed (must be Visible
 | 
						|
        /// and appropriately 'checked' if presented in the Legend).
 | 
						|
        ///</summary>
 | 
						|
        [Browsable(false)]
 | 
						|
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
 | 
						|
        public bool IsDisplayed
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return ((Visible == true) &&
 | 
						|
                        (ShowCheckBoxInLegend == false || CheckedInLegend == true));
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region MaxValue
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Gets or sets the maximum axis stripe value.
 | 
						|
        ///</summary>
 | 
						|
        [DefaultValue(null), Category("Data")]
 | 
						|
        [Description("Indicates the maximum axis stripe value.")]
 | 
						|
        [TypeConverter("DevComponents.Charts.Design.PointValueConverter, DevComponents.Charts.Design," +
 | 
						|
            "Version=14.1.0.37, Culture=neutral, PublicKeyToken=90f470f34c89ccaf")]
 | 
						|
        public object MaxValue
 | 
						|
        {
 | 
						|
            get { return (_MaxValue); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != _MaxValue)
 | 
						|
                {
 | 
						|
                    _MaxValue = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("MaxValue", Style.VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region MinValue
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Gets or sets the minimum axis stripe value.
 | 
						|
        ///</summary>
 | 
						|
        [DefaultValue(null), Category("Data")]
 | 
						|
        [Description("Indicates the minimum axis stripe value.")]
 | 
						|
        [TypeConverter("DevComponents.Charts.Design.PointValueConverter, DevComponents.Charts.Design," +
 | 
						|
            "Version=14.1.0.37, Culture=neutral, PublicKeyToken=90f470f34c89ccaf")]
 | 
						|
        public object MinValue
 | 
						|
        {
 | 
						|
            get { return (_MinValue); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != _MinValue)
 | 
						|
                {
 | 
						|
                    _MinValue = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("MinValue", Style.VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region MeasureOverride
 | 
						|
 | 
						|
        protected override void MeasureOverride(ChartLayoutInfo layoutInfo)
 | 
						|
        {
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ArrangeOverride
 | 
						|
 | 
						|
        protected override void ArrangeOverride(ChartLayoutInfo layoutInfo)
 | 
						|
        {
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region RenderOverride
 | 
						|
 | 
						|
        protected override void RenderOverride(ChartRenderInfo renderInfo)
 | 
						|
        {
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Style support
 | 
						|
 | 
						|
        #region InvalidateStyle
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        ///Invalidate the cached Styles
 | 
						|
        ///</summary>
 | 
						|
        public void InvalidateStyle()
 | 
						|
        {
 | 
						|
            ClearEffectiveStyles();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ClearEffectiveStyles
 | 
						|
 | 
						|
        protected override void ClearEffectiveStyles()
 | 
						|
        {
 | 
						|
            base.ClearEffectiveStyles();
 | 
						|
 | 
						|
            if (LegendItem != null)
 | 
						|
                LegendItem.EffectiveStyles.InvalidateStyles();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region StyleChanged
 | 
						|
 | 
						|
        protected override void StyleChanged(object sender, PropertyChangedEventArgs e)
 | 
						|
        {
 | 
						|
            base.StyleChanged(sender, e);
 | 
						|
 | 
						|
            if (sender is ChartLegendItemVisualStyles && LegendItem != null)
 | 
						|
                InvalidateRender(LegendItem.Bounds);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ILegendItem
 | 
						|
 | 
						|
        #region ChartLegendItemVisualStyles
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the visual styles for the Legend item.
 | 
						|
        /// </summary>
 | 
						|
        [Category("Style")]
 | 
						|
        [Description("Indicates the visual styles for the Legend item.")]
 | 
						|
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
 | 
						|
        public ChartLegendItemVisualStyles ChartLegendItemVisualStyles
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                if (_ChartLegendItemVisualStyles == null)
 | 
						|
                {
 | 
						|
                    _ChartLegendItemVisualStyles = new ChartLegendItemVisualStyles();
 | 
						|
 | 
						|
                    StyleVisualChangeHandler(null, _ChartLegendItemVisualStyles);
 | 
						|
                }
 | 
						|
 | 
						|
                return (_ChartLegendItemVisualStyles);
 | 
						|
            }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_ChartLegendItemVisualStyles != value)
 | 
						|
                {
 | 
						|
                    ChartLegendItemVisualStyles oldValue = _ChartLegendItemVisualStyles;
 | 
						|
 | 
						|
                    _ChartLegendItemVisualStyles = value;
 | 
						|
 | 
						|
                    OnStyleChanged("ChartLegendItemVisualStyles", oldValue, value);
 | 
						|
 | 
						|
                    if (oldValue != null)
 | 
						|
                        oldValue.Dispose();
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region CheckedInLegend
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets whether the ReferenceLine is checked in the Legend.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(true), Category("Legend")]
 | 
						|
        [Description("Indicates whether the ReferenceLine is checked in the Legend.")]
 | 
						|
        public bool CheckedInLegend
 | 
						|
        {
 | 
						|
            get { return (TestState(States.CheckedInLegend)); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != CheckedInLegend)
 | 
						|
                {
 | 
						|
                    SetState(States.CheckedInLegend, value);
 | 
						|
 | 
						|
                    if (LegendItem != null)
 | 
						|
                        LegendItem.UpdateCheckState();
 | 
						|
                    
 | 
						|
                    OnPropertyChangedEx("CheckedInLegend", VisualChangeType.Render);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ShowCheckBoxInLegend
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets whether a checkbox for the ReferenceLine is shown in the Legend.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(true), Category("Legend")]
 | 
						|
        [Description("Indicates whether a checkbox for the ReferenceLine is shown in the Legend.")]
 | 
						|
        public bool ShowCheckBoxInLegend
 | 
						|
        {
 | 
						|
            get { return (TestState(States.ShowCheckBoxInLegend)); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != ShowCheckBoxInLegend)
 | 
						|
                {
 | 
						|
                    SetState(States.ShowCheckBoxInLegend, value);
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ShowCheckBoxInLegend", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ShowInLegend
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets whether the ReferenceLine is shown in the Legend.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(true), Category("Legend")]
 | 
						|
        [Description("Indicates whether the ReferenceLine is shown in the Legend.")]
 | 
						|
        public bool ShowInLegend
 | 
						|
        {
 | 
						|
            get { return (TestState(States.ShowInLegend)); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != ShowInLegend)
 | 
						|
                {
 | 
						|
                    SetState(States.ShowInLegend, value);
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ShowInLegend", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ShowInParentLegend
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets whether the Reference Line is shown in parent Legend(s).
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(true), Category("Legend")]
 | 
						|
        [Description("Indicates whether the Reference Line is shown in parent Legend(s).")]
 | 
						|
        public bool ShowInParentLegend
 | 
						|
        {
 | 
						|
            get { return (TestState(States.ShowInParentLegend)); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != ShowInParentLegend)
 | 
						|
                {
 | 
						|
                    SetState(States.ShowInParentLegend, value);
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ShowInParentLegend", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ShowMarkerInLegend
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets whether the ReferenceLine Marker is shown in the Legend.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(true), Category("Legend")]
 | 
						|
        [Description("Indicates whether the ReferenceLine Marker is shown in the Legend.")]
 | 
						|
        public bool ShowMarkerInLegend
 | 
						|
        {
 | 
						|
            get { return (TestState(States.ShowMarkerInLegend)); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != ShowMarkerInLegend)
 | 
						|
                {
 | 
						|
                    SetState(States.ShowMarkerInLegend, value);
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ShowMarkerInLegend", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region LegendItem
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Gets the item's parent LegendItem.
 | 
						|
        ///</summary>
 | 
						|
        [Browsable(false)]
 | 
						|
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
 | 
						|
        [Description("Indicates the item's parent LegendItem.")]
 | 
						|
        public ChartLegendItem LegendItem
 | 
						|
        {
 | 
						|
            get { return (_LegendItem); }
 | 
						|
            internal set { _LegendItem = value; }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region LegendText
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Gets or sets the text to display in the legend.
 | 
						|
        ///</summary>
 | 
						|
        [DefaultValue(null), Category("Legend")]
 | 
						|
        [Description("Indicates the text to display in the legend.")]
 | 
						|
        [NotifyParentProperty(true)]
 | 
						|
        public string LegendText
 | 
						|
        {
 | 
						|
            get { return (_LegendText); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != _LegendText)
 | 
						|
                {
 | 
						|
                    _LegendText = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("LegendText", Style.VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetLegendItem
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Creates the LegendItem for the AxisStripe.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public ChartLegendItem GetLegendItem()
 | 
						|
        {
 | 
						|
            _LegendItem = null;
 | 
						|
 | 
						|
            if (ShowInLegend == true)
 | 
						|
            {
 | 
						|
                _LegendItem = new ChartLegendItem();
 | 
						|
 | 
						|
                if (CheckedInLegend == true)
 | 
						|
                    _LegendItem.CheckState = CheckState.Checked;
 | 
						|
 | 
						|
                _LegendItem.Name = Name;
 | 
						|
                _LegendItem.ItemText = LegendText;
 | 
						|
 | 
						|
                if (string.IsNullOrEmpty(_LegendItem.Name) == true)
 | 
						|
                    _LegendItem.Name = "(RefLine)";
 | 
						|
 | 
						|
                _LegendItem.ChartItems.Add(this);
 | 
						|
            }
 | 
						|
 | 
						|
            return (_LegendItem);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetLegendItems
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Creates a list of legend items associated with
 | 
						|
        /// the AxisStripe.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public List<ChartLegendItem> GetLegendItems()
 | 
						|
        {
 | 
						|
            List<ChartLegendItem> list = null;
 | 
						|
 | 
						|
            ChartLegendItem item = GetLegendItem();
 | 
						|
 | 
						|
            if (item != null)
 | 
						|
            {
 | 
						|
                list = new List<ChartLegendItem>(1);
 | 
						|
 | 
						|
                list.Add(item);
 | 
						|
            }
 | 
						|
 | 
						|
            return (list);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetLegendItemColor
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets the default color associated with the
 | 
						|
        /// AxisStripe legend item.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public Color GetLegendItemColor()
 | 
						|
        {
 | 
						|
            AxisStripeVisualStyle astyle = AxisStripeVisualStyle;
 | 
						|
 | 
						|
            Color color = astyle.Background.Color1;
 | 
						|
 | 
						|
            if (color.IsEmpty == false)
 | 
						|
                return (color);
 | 
						|
 | 
						|
            return (Color.DimGray);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region RenderLegendItemMarker
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Renders the Legend item Marker.
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="g"></param>
 | 
						|
        /// <param name="litem"></param>
 | 
						|
        /// <param name="style"></param>
 | 
						|
        public void RenderLegendItemMarker(Graphics g,
 | 
						|
            ChartLegendItem litem, ChartLegendItemVisualStyle style)
 | 
						|
        {
 | 
						|
            AxisStripeVisualStyle astyle = AxisStripeVisualStyle;
 | 
						|
 | 
						|
            Rectangle bounds = litem.MarkerBounds;
 | 
						|
 | 
						|
            if (astyle.Background.IsEmpty == true)
 | 
						|
            {
 | 
						|
                g.FillRectangle(Brushes.LightPink, bounds);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                using (Brush br = astyle.Background.GetBrush(bounds))
 | 
						|
                    g.FillRectangle(br, bounds);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Copy/CopyTo
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Creates a copy of the element.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public override ChartVisualElement Copy()
 | 
						|
        {
 | 
						|
            AxisStripe copy = new AxisStripe();
 | 
						|
 | 
						|
            CopyTo(copy);
 | 
						|
 | 
						|
            return (copy);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Copies the current element properties and styles 
 | 
						|
        /// to the provided "copy".
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="copy"></param>
 | 
						|
        public override void CopyTo(ChartVisualElement copy)
 | 
						|
        {
 | 
						|
            AxisStripe c = copy as AxisStripe;
 | 
						|
 | 
						|
            if (c != null)
 | 
						|
            {
 | 
						|
                base.CopyTo(c);
 | 
						|
 | 
						|
                c.AxisStripeVisualStyle =  (_AxisStripeVisualStyle != null) ? _AxisStripeVisualStyle.Copy() : null;
 | 
						|
                c.ChartLegendItemVisualStyles = (_ChartLegendItemVisualStyles != null) ? ChartLegendItemVisualStyles.Copy() : null;
 | 
						|
 | 
						|
                c.MaxValue = MaxValue;
 | 
						|
                c.MinValue = MinValue;
 | 
						|
 | 
						|
                c.CheckedInLegend = CheckedInLegend;
 | 
						|
                c.ShowCheckBoxInLegend = ShowCheckBoxInLegend;
 | 
						|
                c.ShowInLegend = ShowInLegend;
 | 
						|
                c.ShowInParentLegend = ShowInParentLegend;
 | 
						|
                c.LegendText = LegendText;
 | 
						|
                c.ShowMarkerInLegend = ShowMarkerInLegend;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetSerialData
 | 
						|
 | 
						|
        internal override SerialElementCollection GetSerialData(string serialName)
 | 
						|
        {
 | 
						|
            SerialElementCollection sec = new SerialElementCollection();
 | 
						|
 | 
						|
            if (serialName != null)
 | 
						|
            {
 | 
						|
                if (serialName.Equals("") == true)
 | 
						|
                    serialName = "ChartAxis";
 | 
						|
 | 
						|
                sec.AddStartElement(serialName);
 | 
						|
            }
 | 
						|
 | 
						|
            if (_AxisStripeVisualStyle != null && _AxisStripeVisualStyle.IsEmpty == false)
 | 
						|
                sec.AddElement(_AxisStripeVisualStyle.GetSerialData("AxisStripeVisualStyle"));
 | 
						|
 | 
						|
            if (_ChartLegendItemVisualStyles != null)
 | 
						|
                sec.AddElement(_ChartLegendItemVisualStyles.GetSerialData("ChartLegendItemVisualStyles"));
 | 
						|
 | 
						|
            sec.AddDataValue("MaxValue", MaxValue, null);
 | 
						|
            sec.AddDataValue("MinValue", MinValue, null);
 | 
						|
 | 
						|
            sec.AddValue("CheckedInLegend", CheckedInLegend, true);
 | 
						|
            sec.AddValue("LegendText", LegendText, null);
 | 
						|
            sec.AddValue("ShowCheckBoxInLegend", ShowCheckBoxInLegend, true);
 | 
						|
            sec.AddValue("ShowInLegend", ShowInLegend, true);
 | 
						|
            sec.AddValue("ShowInParentLegend", ShowInParentLegend, true);
 | 
						|
            sec.AddValue("ShowMarkerInLegend", ShowMarkerInLegend, true);
 | 
						|
 | 
						|
            sec.AddElement(base.GetSerialData(null));
 | 
						|
 | 
						|
            if (serialName != null)
 | 
						|
                sec.AddEndElement(serialName);
 | 
						|
 | 
						|
            return (sec);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region PutSerialData
 | 
						|
 | 
						|
        #region ProcessValue
 | 
						|
 | 
						|
        internal override void ProcessValue(SerialElement se)
 | 
						|
        {
 | 
						|
            switch (se.Name)
 | 
						|
            {
 | 
						|
                case "CheckedInLegend":
 | 
						|
                    CheckedInLegend = bool.Parse(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "LegendText":
 | 
						|
                    LegendText = se.StringValue;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "MaxValue":
 | 
						|
                    MaxValue = se.DataValue;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "MinValue":
 | 
						|
                    MinValue = se.DataValue;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ShowCheckBoxInLegend":
 | 
						|
                    ShowCheckBoxInLegend = bool.Parse(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ShowInLegend":
 | 
						|
                    ShowInLegend = bool.Parse(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ShowInParentLegend":
 | 
						|
                    ShowInParentLegend = bool.Parse(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ShowMarkerInLegend":
 | 
						|
                    ShowMarkerInLegend = bool.Parse(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                default:
 | 
						|
                    base.ProcessValue(se);
 | 
						|
                    break;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ProcessCollection
 | 
						|
 | 
						|
        internal override void ProcessCollection(SerialElement se)
 | 
						|
        {
 | 
						|
            SerialElementCollection sec = se.Sec;
 | 
						|
 | 
						|
            switch (se.Name)
 | 
						|
            {
 | 
						|
                case "AxisStripeVisualStyle":
 | 
						|
                    sec.PutSerialData(AxisStripeVisualStyle);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ChartLegendItemVisualStyles":
 | 
						|
                    sec.PutSerialData(ChartLegendItemVisualStyles);
 | 
						|
                    break;
 | 
						|
 | 
						|
                default:
 | 
						|
                    base.ProcessCollection(se);
 | 
						|
                    break;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #region GetAncillaryAxis
 | 
						|
 | 
						|
        private ChartAxis GetAncillaryAxis(ChartAxesCollection axes, string name)
 | 
						|
        {
 | 
						|
            foreach (ChartAxis axis in axes)
 | 
						|
            {
 | 
						|
                if (name.Equals(axis.Name) == true)
 | 
						|
                    return (axis);
 | 
						|
            }
 | 
						|
 | 
						|
            return (null);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region States
 | 
						|
 | 
						|
        [Flags]
 | 
						|
        private enum States : uint
 | 
						|
        {
 | 
						|
            CheckedInLegend = (1U << 1),
 | 
						|
            ShowCheckBoxInLegend = (1U << 2),
 | 
						|
            ShowInLegend = (1U << 3),
 | 
						|
            ShowInParentLegend = (1U << 4),
 | 
						|
            ShowMarkerInLegend = (1U << 5),
 | 
						|
        }
 | 
						|
 | 
						|
        #region TestState
 | 
						|
 | 
						|
        private bool TestState(States state)
 | 
						|
        {
 | 
						|
            return ((_States & state) == state);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region SetState
 | 
						|
 | 
						|
        private void SetState(States state, bool value)
 | 
						|
        {
 | 
						|
            if (value == true)
 | 
						|
                _States |= state;
 | 
						|
            else
 | 
						|
                _States &= ~state;
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region IDisposable
 | 
						|
 | 
						|
        public override void Dispose()
 | 
						|
        {
 | 
						|
            AxisStripeVisualStyle = null;
 | 
						|
 | 
						|
            base.Dispose();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
}
 |