#region PDFsharp Charting - A .NET charting library based on PDFsharp // // Authors: // Niklas Schneider // // Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany) // // http://www.pdfsharp.com // http://sourceforge.net/projects/pdfsharp // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #endregion using System; using PdfSharp.Drawing; #if !SILVERLIGHT using System.ComponentModel; #endif namespace PdfSharp.Charting { /// /// Represents a series of data on the chart. /// public class Series : ChartObject { /// /// Initializes a new instance of the Series class. /// public Series() { } #region Methods /// /// Creates a deep copy of this object. /// public new Series Clone() { return (Series)DeepCopy(); } /// /// Implements the deep copy of the object. /// protected override object DeepCopy() { Series series = (Series)base.DeepCopy(); if (series._seriesElements != null) { series._seriesElements = series._seriesElements.Clone(); series._seriesElements._parent = series; } if (series._lineFormat != null) { series._lineFormat = series._lineFormat.Clone(); series._lineFormat._parent = series; } if (series._fillFormat != null) { series._fillFormat = series._fillFormat.Clone(); series._fillFormat._parent = series; } if (series._dataLabel != null) { series._dataLabel = series._dataLabel.Clone(); series._dataLabel._parent = series; } return series; } /// /// Adds a blank to the series. /// public void AddBlank() { Elements.AddBlank(); } /// /// Adds a real value to the series. /// public Point Add(double value) { return Elements.Add(value); } /// /// Adds an array of real values to the series. /// public void Add(params double[] values) { Elements.Add(values); } #endregion #region Properties /// /// The actual value container of the series. /// public SeriesElements Elements { get { return _seriesElements ?? (_seriesElements = new SeriesElements(this)); } } internal SeriesElements _seriesElements; /// /// Gets or sets the name of the series which will be used in the legend. /// public string Name { get { return _name; } set { _name = value; } } internal string _name = String.Empty; /// /// Gets the line format of the border of each data. /// public LineFormat LineFormat { get { return _lineFormat ?? (_lineFormat = new LineFormat(this)); } } internal LineFormat _lineFormat; /// /// Gets the background filling of the data. /// public FillFormat FillFormat { get { return _fillFormat ?? (_fillFormat = new FillFormat(this)); } } internal FillFormat _fillFormat; /// /// Gets or sets the size of the marker in a line chart. /// public XUnit MarkerSize { get { return _markerSize; } set { _markerSize = value; } } internal XUnit _markerSize; /// /// Gets or sets the style of the marker in a line chart. /// public MarkerStyle MarkerStyle { get { return _markerStyle; } set { if (!Enum.IsDefined(typeof(MarkerStyle), value)) throw new InvalidEnumArgumentException("value", (int)value, typeof(MarkerStyle)); _markerStyle = value; _markerStyleInitialized = true; } } internal MarkerStyle _markerStyle; internal bool _markerStyleInitialized; /// /// Gets or sets the foreground color of the marker in a line chart. /// public XColor MarkerForegroundColor { get { return _markerForegroundColor; } set { _markerForegroundColor = value; } } internal XColor _markerForegroundColor = XColor.Empty; /// /// Gets or sets the background color of the marker in a line chart. /// public XColor MarkerBackgroundColor { get { return _markerBackgroundColor; } set { _markerBackgroundColor = value; } } internal XColor _markerBackgroundColor = XColor.Empty; /// /// Gets or sets the chart type of the series if it's intended to be different than the /// global chart type. /// public ChartType ChartType { get { return _chartType; } set { if (!Enum.IsDefined(typeof(ChartType), value)) throw new InvalidEnumArgumentException("value", (int)value, typeof(ChartType)); _chartType = value; } } internal ChartType _chartType; /// /// Gets the DataLabel of the series. /// public DataLabel DataLabel { get { return _dataLabel ?? (_dataLabel = new DataLabel(this)); } } internal DataLabel _dataLabel; /// /// Gets or sets whether the series has a DataLabel. /// public bool HasDataLabel { get { return _hasDataLabel; } set { _hasDataLabel = value; } } internal bool _hasDataLabel; /// /// Gets the element count of the series. /// public int Count { get { return _seriesElements != null ? _seriesElements.Count : 0; } } #endregion } }