using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
namespace DevComponents.DotNetBar.Charts.Style
{
    /// 
    /// Represents the visual style of a ChartSeries
    /// 
    [ToolboxItem(false), DesignTimeVisible(false)]
    [TypeConverter(typeof(VisualStylesConverter))]
    public class ChartSeriesVisualStyle : BaseVisualStyle
    {
        #region Private variables
        private ChartLineVisualStyle _LineStyle;
        private ChartLineVisualStyle _SplineStyle;
        private ChartCapLineVisualStyle _StepLineStyle;
        private ChartBarVisualStyle _BarVisualStyle;
        private ChartHiLoBarVisualStyle _HiLoBarVisualStyle;
        private Background _EmptyAreaBackground;
        private Background _LineAreaBackground;
        private Background _SplineAreaBackground;
        private Background _StepLineAreaBackground;
        private ChartCapLineVisualStyle _StepLineAltStyle;
        private ChartLineVisualStyle _EmptyStyle;
        private PointMarkerVisualStyle _MarkerVisualStyle;
        private PointMarkerVisualStyle _MarkerHighlightVisualStyle;
        private PointMarkerVisualStyle _MarkerEmptyVisualStyle;
        private ChartLineVisualStyle _ConvexHullLineStyle;
        private Background _ConvexHullBackground;
        private ChartSliceVisualStyle _SliceVisualStyle;
        private Color _ItemColor = Color.Empty;
        #endregion
        #region Public properties
        #region BarVisualStyle
        /// 
        /// Gets or sets the visual style for series Bars.
        /// 
        [Category("Style")]
        [Description("Indicates the visual style for series Bars.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartBarVisualStyle BarVisualStyle
        {
            get
            {
                if (_BarVisualStyle == null)
                {
                    _BarVisualStyle = new ChartBarVisualStyle();
                    UpdateChangeHandler(null, _BarVisualStyle);
                }
                return (_BarVisualStyle);
            }
            set
            {
                if (_BarVisualStyle != value)
                {
                    ChartBarVisualStyle oldValue = _BarVisualStyle;
                    _BarVisualStyle = value;
                    OnStyleChanged("BarVisualStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region ConvexHullBackground
        /// 
        /// Gets or sets the ConvexHull background.
        /// 
        [Description("Indicates the the ConvexHull background.")]
        public Background ConvexHullBackground
        {
            get
            {
                if (_ConvexHullBackground == null)
                {
                    _ConvexHullBackground = Background.Empty;
                    UpdateChangeHandler(null, _ConvexHullBackground);
                }
                return (_ConvexHullBackground);
            }
            set
            {
                if (_ConvexHullBackground != value)
                {
                    UpdateChangeHandler(_ConvexHullBackground, value);
                    _ConvexHullBackground = value;
                    OnPropertyChangedEx("ConvexHullBackground", VisualChangeType.Render);
                }
            }
        }
        /// 
        /// Gets whether property should be serialized.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private bool ShouldSerializeConvexHullBackground()
        {
            return (_ConvexHullBackground != null && _ConvexHullBackground.IsEmpty == false);
        }
        /// 
        /// Resets property to its default value.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private void ResetConvexHullBackground()
        {
            ConvexHullBackground = null;
        }
        #endregion
        #region ConvexHullLineStyle
        /// 
        /// Gets or sets the visual style for the ConvexHull Lines.
        /// 
        [Category("Style")]
        [Description("Indicates the visual style for the ConvexHull Lines.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartLineVisualStyle ConvexHullLineStyle
        {
            get
            {
                if (_ConvexHullLineStyle == null)
                {
                    _ConvexHullLineStyle = new ChartLineVisualStyle();
                    UpdateChangeHandler(null, _ConvexHullLineStyle);
                }
                return (_ConvexHullLineStyle);
            }
            set
            {
                if (_ConvexHullLineStyle != value)
                {
                    ChartLineVisualStyle oldValue = _ConvexHullLineStyle;
                    _ConvexHullLineStyle = value;
                    OnStyleChanged("ConvexHullLineStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region EmptyAreaBackground
        /// 
        /// Gets or sets the Empty Area Background.
        /// 
        [Description("Indicates the Empty Area Background.")]
        public Background EmptyAreaBackground
        {
            get
            {
                if (_EmptyAreaBackground == null)
                {
                    _EmptyAreaBackground = Background.Empty;
                    UpdateChangeHandler(null, _EmptyAreaBackground);
                }
                return (_EmptyAreaBackground);
            }
            set
            {
                if (_EmptyAreaBackground != value)
                {
                    UpdateChangeHandler(_EmptyAreaBackground, value);
                    _EmptyAreaBackground = value;
                    OnPropertyChangedEx("EmptyAreaBackground", VisualChangeType.Render);
                }
            }
        }
        /// 
        /// Gets whether property should be serialized.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private bool ShouldSerializeEmptyAreaBackground()
        {
            return (_EmptyAreaBackground != null && _EmptyAreaBackground.IsEmpty == false);
        }
        /// 
        /// Resets property to its default value.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private void ResetEmptyAreaBackground()
        {
            _EmptyAreaBackground = null;
        }
        #endregion
        #region EmptyStyle
        /// 
        /// Gets or sets the visual styles for series EmptyValue Lines.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for series EmptyValue Lines.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartLineVisualStyle EmptyStyle
        {
            get
            {
                if (_EmptyStyle == null)
                {
                    _EmptyStyle = new ChartLineVisualStyle();
                    UpdateChangeHandler(null, _EmptyStyle);
                }
                return (_EmptyStyle);
            }
            set
            {
                if (_EmptyStyle != value)
                {
                    ChartLineVisualStyle oldValue = _EmptyStyle;
                    _EmptyStyle = value;
                    OnStyleChanged("EmptyLineStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region HiLoBarVisualStyle
        /// 
        /// Gets or sets the visual style for series Hilo Bars.
        /// 
        [Category("Style")]
        [Description("Indicates the visual style for series Hilo Bars.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartHiLoBarVisualStyle HiLoBarVisualStyle
        {
            get
            {
                if (_HiLoBarVisualStyle == null)
                {
                    _HiLoBarVisualStyle = new ChartHiLoBarVisualStyle();
                    UpdateChangeHandler(null, _HiLoBarVisualStyle);
                }
                return (_HiLoBarVisualStyle);
            }
            set
            {
                if (_HiLoBarVisualStyle != value)
                {
                    ChartHiLoBarVisualStyle oldValue = _HiLoBarVisualStyle;
                    _HiLoBarVisualStyle = value;
                    OnStyleChanged("HiloBarVisualStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region ItemColor
        /// 
        /// Gets or sets the default color to use for the item.
        /// 
        [Description("Indicates the default color to use for the item")]
        public Color ItemColor
        {
            get { return (_ItemColor); }
            set
            {
                if (_ItemColor != value)
                {
                    _ItemColor = value;
                    OnPropertyChangedEx("ItemColor", VisualChangeType.Render);
                }
            }
        }
        /// 
        /// Gets whether property should be serialized.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private bool ShouldSerializeItemColor()
        {
            return (_ItemColor.IsEmpty == false);
        }
        /// 
        /// Resets property to its default value.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private void ResetItemColor()
        {
            _ItemColor = Color.Empty;
        }
        #endregion
        #region LineAreaBackground
        /// 
        /// Gets or sets the Line Area Background (area under the series 'Line').
        /// 
        [Description("Indicates the Line Area Background (area under the series 'Line').")]
        public Background LineAreaBackground
        {
            get
            {
                if (_LineAreaBackground == null)
                {
                    _LineAreaBackground = Background.Empty;
                    UpdateChangeHandler(null, _LineAreaBackground);
                }
                return (_LineAreaBackground);
            }
            set
            {
                if (_LineAreaBackground != value)
                {
                    UpdateChangeHandler(_LineAreaBackground, value);
                    _LineAreaBackground = value;
                    OnPropertyChangedEx("LineAreaBackground", VisualChangeType.Render);
                }
            }
        }
        /// 
        /// Gets whether property should be serialized.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private bool ShouldSerializeLineAreaBackground()
        {
            return (_LineAreaBackground != null && _LineAreaBackground.IsEmpty == false);
        }
        /// 
        /// Resets property to its default value.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private void ResetLineAreaBackground()
        {
            LineAreaBackground = null;
        }
        #endregion
        #region LineStyle
        /// 
        /// Gets or sets the visual styles for series Lines.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for series Lines.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartLineVisualStyle LineStyle
        {
            get
            {
                if (_LineStyle == null)
                {
                    _LineStyle = new ChartLineVisualStyle();
                    UpdateChangeHandler(null, _LineStyle);
                }
                return (_LineStyle);
            }
            set
            {
                if (_LineStyle != value)
                {
                    ChartLineVisualStyle oldValue = _LineStyle;
                    _LineStyle = value;
                    OnStyleChanged("LineStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region MarkerEmptyVisualStyle
        /// 
        /// Gets or sets the visual styles for the Empty PointMarker.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for the Empty PointMarker.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public PointMarkerVisualStyle MarkerEmptyVisualStyle
        {
            get
            {
                if (_MarkerEmptyVisualStyle == null)
                {
                    _MarkerEmptyVisualStyle = new PointMarkerVisualStyle();
                    UpdateChangeHandler(null, _MarkerEmptyVisualStyle);
                }
                return (_MarkerEmptyVisualStyle);
            }
            set
            {
                if (_MarkerEmptyVisualStyle != value)
                {
                    PointMarkerVisualStyle oldValue = _MarkerEmptyVisualStyle;
                    _MarkerEmptyVisualStyle = value;
                    OnStyleChanged("MarkerEmptyVisualStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region MarkerHighlightVisualStyle
        /// 
        /// Gets or sets the visual styles for the PointMarker Highlight.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for the PointMarker Highlight.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public PointMarkerVisualStyle MarkerHighlightVisualStyle
        {
            get
            {
                if (_MarkerHighlightVisualStyle == null)
                {
                    _MarkerHighlightVisualStyle = new PointMarkerVisualStyle();
                    UpdateChangeHandler(null, _MarkerHighlightVisualStyle);
                }
                return (_MarkerHighlightVisualStyle);
            }
            set
            {
                if (_MarkerHighlightVisualStyle != value)
                {
                    PointMarkerVisualStyle oldValue = _MarkerHighlightVisualStyle;
                    _MarkerHighlightVisualStyle = value;
                    OnStyleChanged("MarkerHighlightVisualStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region MarkerVisualStyle
        /// 
        /// Gets or sets the visual styles for the PointMarker.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for the PointMarker.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public PointMarkerVisualStyle MarkerVisualStyle
        {
            get
            {
                if (_MarkerVisualStyle == null)
                {
                    _MarkerVisualStyle = new PointMarkerVisualStyle();
                    UpdateChangeHandler(null, _MarkerVisualStyle);
                }
                return (_MarkerVisualStyle);
            }
            set
            {
                if (_MarkerVisualStyle != value)
                {
                    PointMarkerVisualStyle oldValue = _MarkerVisualStyle;
                    _MarkerVisualStyle = value;
                    OnStyleChanged("MarkerVisualStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region SliceVisualStyle
        /// 
        /// Gets or sets the default visual style for series Pie Slices.
        /// 
        [Category("Style")]
        [Description("Indicates the default visual style for series Pie Slices.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartSliceVisualStyle SliceVisualStyle
        {
            get
            {
                if (_SliceVisualStyle == null)
                {
                    _SliceVisualStyle = new ChartSliceVisualStyle();
                    UpdateChangeHandler(null, _SliceVisualStyle);
                }
                return (_SliceVisualStyle);
            }
            set
            {
                if (_SliceVisualStyle != value)
                {
                    ChartSliceVisualStyle oldValue = _SliceVisualStyle;
                    _SliceVisualStyle = value;
                    OnStyleChanged("SliceVisualStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region SplineAreaBackground
        /// 
        /// Gets or sets the Spline Area Background (area under the series 'Spline').
        /// 
        [Description("Indicates the Spline Area Background (area under the series 'Spline').")]
        public Background SplineAreaBackground
        {
            get
            {
                if (_SplineAreaBackground == null)
                {
                    _SplineAreaBackground = Background.Empty;
                    UpdateChangeHandler(null, _SplineAreaBackground);
                }
                return (_SplineAreaBackground);
            }
            set
            {
                if (_SplineAreaBackground != value)
                {
                    UpdateChangeHandler(_SplineAreaBackground, value);
                    _SplineAreaBackground = value;
                    OnPropertyChangedEx("SplineAreaBackground", VisualChangeType.Render);
                }
            }
        }
        /// 
        /// Gets whether property should be serialized.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private bool ShouldSerializeSplineAreaBackground()
        {
            return (_SplineAreaBackground != null && _SplineAreaBackground.IsEmpty == false);
        }
        /// 
        /// Resets property to its default value.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private void ResetSplineAreaBackground()
        {
            SplineAreaBackground = null;
        }
        #endregion
        #region SplineStyle
        /// 
        /// Gets or sets the visual styles for series Splines.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for series Splines.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartLineVisualStyle SplineStyle
        {
            get
            {
                if (_SplineStyle == null)
                {
                    _SplineStyle = new ChartLineVisualStyle();
                    UpdateChangeHandler(null, _SplineStyle);
                }
                return (_SplineStyle);
            }
            set
            {
                if (_SplineStyle != value)
                {
                    ChartLineVisualStyle oldValue = _SplineStyle;
                    _SplineStyle = value;
                    OnStyleChanged("SplineStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region StepLineAreaBackground
        /// 
        /// Gets or sets the StepLine Area Background (area under the series 'StepLines').
        /// 
        [Description("Indicates the StepLine Area Background (area under the series 'StepLines').")]
        public Background StepLineAreaBackground
        {
            get
            {
                if (_StepLineAreaBackground == null)
                {
                    _StepLineAreaBackground = Background.Empty;
                    UpdateChangeHandler(null, _StepLineAreaBackground);
                }
                return (_StepLineAreaBackground);
            }
            set
            {
                if (_StepLineAreaBackground != value)
                {
                    UpdateChangeHandler(_StepLineAreaBackground, value);
                    _StepLineAreaBackground = value;
                    OnPropertyChangedEx("StepLineAreaBackground", VisualChangeType.Render);
                }
            }
        }
        /// 
        /// Gets whether property should be serialized.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private bool ShouldSerializeStepLineAreaBackground()
        {
            return (_StepLineAreaBackground != null && _StepLineAreaBackground.IsEmpty == false);
        }
        /// 
        /// Resets property to its default value.
        /// 
        [EditorBrowsable(EditorBrowsableState.Never)]
        private void ResetStepLineAreaBackground()
        {
            StepLineAreaBackground = null;
        }
        #endregion
        #region StepLineStyle
        /// 
        /// Gets or sets the visual styles for series Step Lines.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for series Step Lines.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartCapLineVisualStyle StepLineStyle
        {
            get
            {
                if (_StepLineStyle == null)
                {
                    _StepLineStyle = new ChartCapLineVisualStyle();
                    UpdateChangeHandler(null, _StepLineStyle);
                }
                return (_StepLineStyle);
            }
            set
            {
                if (_StepLineStyle != value)
                {
                    ChartCapLineVisualStyle oldValue = _StepLineStyle;
                    _StepLineStyle = value;
                    OnStyleChanged("StepLineStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region StepLineAltStyle
        /// 
        /// Gets or sets the visual styles for 'Alternate' series Step Lines.
        /// 
        [Category("Style")]
        [Description("Indicates the visual styles for 'Alternate' series Step Lines.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ChartCapLineVisualStyle StepLineAltStyle
        {
            get
            {
                if (_StepLineAltStyle == null)
                {
                    _StepLineAltStyle = new ChartCapLineVisualStyle();
                    UpdateChangeHandler(null, _StepLineAltStyle);
                }
                return (_StepLineAltStyle);
            }
            set
            {
                if (_StepLineAltStyle != value)
                {
                    ChartCapLineVisualStyle oldValue = _StepLineAltStyle;
                    _StepLineAltStyle = value;
                    OnStyleChanged("StepLineAltStyle", oldValue, value);
                    if (oldValue != null)
                        oldValue.Dispose();
                }
            }
        }
        #endregion
        #region IsEmpty
        /// 
        /// Gets whether the style is logically Empty.
        /// 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [Description("Gets whether the style is logically Empty.")]
        public override bool IsEmpty
        {
            get
            {
                return ((_BarVisualStyle == null || _BarVisualStyle.IsEmpty) &&
                    (_ConvexHullBackground == null || _ConvexHullBackground.IsEmpty == true) &&
                    (_ConvexHullLineStyle == null || _ConvexHullLineStyle.IsEmpty) &&
                    (_EmptyAreaBackground == null || _EmptyAreaBackground.IsEmpty == true) &&
                    (_EmptyStyle == null || _EmptyStyle.IsEmpty) &&
                    (_HiLoBarVisualStyle == null || _HiLoBarVisualStyle.IsEmpty) &&
                    (_ItemColor.IsEmpty) &&
                    (_LineAreaBackground == null || _LineAreaBackground.IsEmpty == true) &&
                    (_LineStyle == null || _LineStyle.IsEmpty) &&
                    (_MarkerVisualStyle == null || _MarkerVisualStyle.IsEmpty) &&
                    (_MarkerHighlightVisualStyle == null || _MarkerHighlightVisualStyle.IsEmpty) &&
                    (_SliceVisualStyle == null || _SliceVisualStyle.IsEmpty) &&
                    (_SplineAreaBackground == null || _SplineAreaBackground.IsEmpty == true) && 
                    (_SplineStyle == null || _SplineStyle.IsEmpty) &&
                    (_StepLineAreaBackground == null || _StepLineAreaBackground.IsEmpty == true) &&
                    (_StepLineStyle == null || _StepLineStyle.IsEmpty) &&
                    (_StepLineAltStyle == null || _StepLineAltStyle.IsEmpty) &&
                    (base.IsEmpty == true));
            }
        }
        #endregion
        #endregion
        #region ApplyStyle
        /// 
        /// Applies the style to instance of this style.
        /// 
        /// Style to apply.
        public void ApplyStyle(ChartSeriesVisualStyle style)
        {
            if (style != null)
            {
                base.ApplyStyle(style);
                if (style._BarVisualStyle != null && style._BarVisualStyle.IsEmpty == false)
                    BarVisualStyle.ApplyStyle(style.BarVisualStyle);
                if (style._ConvexHullBackground != null && style._ConvexHullBackground.IsEmpty == false)
                    ConvexHullBackground = style._ConvexHullBackground.Copy();
                if (style._ConvexHullLineStyle != null && style.ConvexHullLineStyle.IsEmpty == false)
                    ConvexHullLineStyle.ApplyStyle(style.ConvexHullLineStyle);
                if (style._EmptyAreaBackground != null && style._EmptyAreaBackground.IsEmpty == false)
                    EmptyAreaBackground = style._EmptyAreaBackground.Copy();
                if (style._EmptyStyle != null && style.EmptyStyle.IsEmpty == false)
                    EmptyStyle.ApplyStyle(style.EmptyStyle);
                if (style._HiLoBarVisualStyle != null && style._HiLoBarVisualStyle.IsEmpty == false)
                    HiLoBarVisualStyle.ApplyStyle(style.HiLoBarVisualStyle);
                if (style.ItemColor.IsEmpty == false)
                    ItemColor = style.ItemColor;
                if (style._LineAreaBackground != null && style._LineAreaBackground.IsEmpty == false)
                    LineAreaBackground = style._LineAreaBackground.Copy();
                if (style._LineStyle != null && style.LineStyle.IsEmpty == false)
                    LineStyle.ApplyStyle(style.LineStyle);
                if (style._MarkerEmptyVisualStyle != null && style.MarkerEmptyVisualStyle.IsEmpty == false)
                    MarkerEmptyVisualStyle.ApplyStyle(style.MarkerEmptyVisualStyle);
                if (style._MarkerHighlightVisualStyle != null && style.MarkerHighlightVisualStyle.IsEmpty == false)
                    MarkerHighlightVisualStyle.ApplyStyle(style.MarkerHighlightVisualStyle);
                if (style._MarkerVisualStyle != null && style.MarkerVisualStyle.IsEmpty == false)
                    MarkerVisualStyle.ApplyStyle(style.MarkerVisualStyle);
                if (style._HiLoBarVisualStyle != null && style._HiLoBarVisualStyle.IsEmpty == false)
                    HiLoBarVisualStyle.ApplyStyle(style.HiLoBarVisualStyle);
                if (style._SliceVisualStyle != null && style._SliceVisualStyle.IsEmpty == false)
                    SliceVisualStyle.ApplyStyle(style.SliceVisualStyle);
                if (style._SplineAreaBackground != null && style._SplineAreaBackground.IsEmpty == false)
                    SplineAreaBackground = style._SplineAreaBackground.Copy();
                if (style._SplineStyle != null && style.SplineStyle.IsEmpty == false)
                    SplineStyle.ApplyStyle(style.SplineStyle);
                if (style._StepLineAreaBackground != null && style._StepLineAreaBackground.IsEmpty == false)
                    StepLineAreaBackground = style._StepLineAreaBackground.Copy();
                if (style._StepLineStyle != null && style.StepLineStyle.IsEmpty == false)
                    StepLineStyle.ApplyStyle(style.StepLineStyle);
                if (style._StepLineAltStyle != null && style.StepLineAltStyle.IsEmpty == false)
                    StepLineAltStyle.ApplyStyle(style.StepLineAltStyle);
            }
        }
        #endregion
        #region Copy
        /// 
        /// Returns the copy of the style.
        /// 
        /// Copy of the style.
        public new ChartSeriesVisualStyle Copy()
        {
            ChartSeriesVisualStyle style = new ChartSeriesVisualStyle();
            CopyTo(style);
            return (style);
        }
        #endregion
        #region CopyTo
        /// 
        /// Returns the copy of the style.
        /// 
        /// Copy of the style.
        public void CopyTo(ChartSeriesVisualStyle style)
        {
            base.CopyTo(style);
            style.BarVisualStyle = (_BarVisualStyle != null) ? _BarVisualStyle.Copy() : null;
            style.ConvexHullBackground = (_ConvexHullBackground != null) ? _ConvexHullBackground.Copy() : null;
            style.ConvexHullLineStyle = (_ConvexHullLineStyle != null) ? _ConvexHullLineStyle.Copy() : null;
            style.EmptyAreaBackground = (_EmptyAreaBackground != null) ? _EmptyAreaBackground.Copy() : null;
            style.EmptyStyle = (_EmptyStyle != null) ? _EmptyStyle.Copy() : null;
            style.HiLoBarVisualStyle = (_HiLoBarVisualStyle != null) ? _HiLoBarVisualStyle.Copy() : null;
            style.ItemColor = ItemColor;
            style.LineAreaBackground = (_LineAreaBackground != null) ? _LineAreaBackground.Copy() : null;
            style.LineStyle = (_LineStyle != null) ? _LineStyle.Copy() : null;
            style.MarkerEmptyVisualStyle = (_MarkerEmptyVisualStyle != null) ? _MarkerEmptyVisualStyle.Copy() : null;
            style.MarkerHighlightVisualStyle = (_MarkerHighlightVisualStyle != null) ? _MarkerHighlightVisualStyle.Copy() : null;
            style.MarkerVisualStyle = (_MarkerVisualStyle != null) ? _MarkerVisualStyle.Copy() : null;
            style.SliceVisualStyle = (_SliceVisualStyle != null) ? _SliceVisualStyle.Copy() : null;
            style.SplineAreaBackground = (_SplineAreaBackground != null) ? _SplineAreaBackground.Copy() : null;
            style.SplineStyle = (_SplineStyle != null) ? _SplineStyle.Copy() : null;
            style.StepLineAltStyle = (_StepLineAltStyle != null) ? _StepLineAltStyle.Copy() : null;
            style.StepLineAreaBackground = (_StepLineAreaBackground != null) ? _StepLineAreaBackground.Copy() : null;
            style.StepLineStyle = (_StepLineStyle != null) ? _StepLineStyle.Copy() : null;
        }
        #endregion
        #region GetSerialData
        internal override SerialElementCollection GetSerialData(string serialName)
        {
            SerialElementCollection sec = new SerialElementCollection();
            if (serialName != null)
            {
                if (serialName.Equals("") == true)
                    serialName = "ChartSeriesVisualStyle";
                sec.AddStartElement(serialName);
            }
            if (_BarVisualStyle != null && _BarVisualStyle.IsEmpty == false)
                sec.AddElement(_BarVisualStyle.GetSerialData("BarVisualStyle"));
            if (_ConvexHullBackground != null && _ConvexHullBackground.IsEmpty == false)
                sec.AddElement(_ConvexHullBackground.GetSerialData("ConvexHullBackground"));
            if (_ConvexHullLineStyle != null && _ConvexHullLineStyle.IsEmpty == false)
                sec.AddElement(_ConvexHullLineStyle.GetSerialData("ConvexHullLineStyle"));
            if (_EmptyAreaBackground != null && _EmptyAreaBackground.IsEmpty == false)
                sec.AddElement(_EmptyAreaBackground.GetSerialData("EmptyAreaBackground"));
            if (_EmptyStyle != null && _EmptyStyle.IsEmpty == false)
                sec.AddElement(_EmptyStyle.GetSerialData("EmptyStyle"));
            sec.AddValue("ItemColor", ItemColor, Color.Empty);
            if (_HiLoBarVisualStyle != null && _HiLoBarVisualStyle.IsEmpty == false)
                sec.AddElement(_HiLoBarVisualStyle.GetSerialData("HiLoBarVisualStyle"));
            if (_LineAreaBackground != null && _LineAreaBackground.IsEmpty == false)
                sec.AddElement(_LineAreaBackground.GetSerialData("LineAreaBackground"));
            if (_LineStyle != null && _LineStyle.IsEmpty == false)
                sec.AddElement(_LineStyle.GetSerialData("LineStyle"));
            if (_MarkerEmptyVisualStyle != null && _MarkerEmptyVisualStyle.IsEmpty == false)
                sec.AddElement(_MarkerEmptyVisualStyle.GetSerialData("MarkerEmptyVisualStyle"));
            if (_MarkerHighlightVisualStyle != null && _MarkerHighlightVisualStyle.IsEmpty == false)
                sec.AddElement(_MarkerHighlightVisualStyle.GetSerialData("MarkerHighlightVisualStyle"));
            if (_MarkerVisualStyle != null && _MarkerVisualStyle.IsEmpty == false)
                sec.AddElement(_MarkerVisualStyle.GetSerialData("MarkerVisualStyle"));
            if (_SplineAreaBackground != null && _SplineAreaBackground.IsEmpty == false)
                sec.AddElement(_SplineAreaBackground.GetSerialData("SplineAreaBackground"));
            if (_SplineStyle != null && _SplineStyle.IsEmpty == false)
                sec.AddElement(_SplineStyle.GetSerialData("SplineStyle"));
            if (_StepLineAreaBackground != null && _StepLineAreaBackground.IsEmpty == false)
                sec.AddElement(_StepLineAreaBackground.GetSerialData("StepLineAreaBackground"));
            if (_StepLineStyle != null && _StepLineStyle.IsEmpty == false)
                sec.AddElement(_StepLineStyle.GetSerialData("StepLineStyle"));
            if (_StepLineAltStyle != null && _StepLineAltStyle.IsEmpty == false)
                sec.AddElement(_StepLineAltStyle.GetSerialData("StepLineAltStyle"));
            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 "ItemColor":
                    ItemColor = se.GetValueColor();
                    break;
                default:
                    base.ProcessValue(se);
                    break;
            }
        }
        #endregion
        #region ProcessCollection
        internal override void ProcessCollection(SerialElement se)
        {
            SerialElementCollection sec = se.Sec;
            switch (se.Name)
            {
                case "BarVisualStyle":
                    sec.PutSerialData(BarVisualStyle);
                    break;
                case "ConvexHullBackground":
                    sec.PutSerialData(ConvexHullBackground);
                    break;
                case "ConvexHullLineStyle":
                    sec.PutSerialData(ConvexHullLineStyle);
                    break;
                case "EmptyAreaBackground":
                    sec.PutSerialData(EmptyAreaBackground);
                    break;
                case "EmptyStyle":
                    sec.PutSerialData(EmptyStyle);
                    break;
                case "HiLoBarVisualStyle":
                    sec.PutSerialData(HiLoBarVisualStyle);
                    break;
                
                case "LineAreaBackground":
                    sec.PutSerialData(LineAreaBackground);
                    break;
                case "LineStyle":
                    sec.PutSerialData(LineStyle);
                    break;
                case "MarkerEmptyVisualStyle":
                    sec.PutSerialData(MarkerEmptyVisualStyle);
                    break;
                case "MarkerHighlightVisualStyle":
                    sec.PutSerialData(MarkerHighlightVisualStyle);
                    break;
                case "MarkerVisualStyle":
                    sec.PutSerialData(MarkerVisualStyle);
                    break;
                case "SplineAreaBackground":
                    sec.PutSerialData(SplineAreaBackground);
                    break;
                case "SplineStyle":
                    sec.PutSerialData(SplineStyle);
                    break;
                case "StepLineAreaBackground":
                    sec.PutSerialData(StepLineAreaBackground);
                    break;
                case "StepLineStyle":
                    sec.PutSerialData(StepLineStyle);
                    break;
                case "StepLineAltStyle":
                    sec.PutSerialData(StepLineAltStyle);
                    break;
                default:
                    base.ProcessCollection(se);
                    break;
            }
        }
        #endregion
        #endregion
        #region IDisposable
        /// 
        /// Dispose
        /// 
        public override void Dispose()
        {
            BarVisualStyle = null;
            ConvexHullBackground = null;
            ConvexHullLineStyle = null;
            EmptyAreaBackground = null;
            EmptyStyle = null;
            HiLoBarVisualStyle = null;
            LineAreaBackground = null;
            LineStyle = null;
            MarkerEmptyVisualStyle = null;
            MarkerHighlightVisualStyle = null;
            MarkerVisualStyle = null;
            SliceVisualStyle = null;
            SplineAreaBackground = null;
            SplineStyle = null;
            StepLineAreaBackground = null;
            StepLineStyle = null;
            StepLineAreaBackground = null;
            StepLineStyle = null;
            StepLineAltStyle = null;
            base.Dispose();
        }
        #endregion
    }
}