Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3107_LearningALPS/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChart.cs

Last change on this file was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 5.4 KB
Line 
1/*******************************************************************************
2 * You may amend and distribute as you like, but don't remove this header!
3 *
4 * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
5 * See http://www.codeplex.com/EPPlus for details.
6 *
7 * Copyright (C) 2011  Jan Källman
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
17 * See the GNU Lesser General Public License for more details.
18 *
19 * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
20 * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
21 *
22 * All code and executables are provided "as is" with no warranty either express or implied.
23 * The author accepts no liability for any damage or loss of business that this product may cause.
24 *
25 * Code change notes:
26 *
27 * Author             Change            Date
28 * ******************************************************************************
29 * Jan Källman    Initial Release           2009-10-01
30 * Jan Källman    License changed GPL-->LGPL 2011-12-16
31 *******************************************************************************/
32using System;
33using System.Collections.Generic;
34using System.Text;
35using System.Xml;
36using OfficeOpenXml.Table.PivotTable;
37
38namespace OfficeOpenXml.Drawing.Chart
39{
40    /// <summary>
41    /// Provides access to line chart specific properties
42    /// </summary>
43    public class ExcelLineChart : ExcelChart
44    {
45        #region "Constructors"
46        internal ExcelLineChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
47            base(drawings, node, uriChart, part, chartXml, chartNode)
48        {
49        }
50
51        internal ExcelLineChart (ExcelChart topChart, XmlNode chartNode) :
52            base(topChart, chartNode)
53        {
54        }
55        internal ExcelLineChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
56            base(drawings, node, type, topChart, PivotTableSource)
57        {
58            Smooth = false;
59        }
60        #endregion
61        string MARKER_PATH="c:marker/@val";
62        /// <summary>
63        /// If the series has markers
64        /// </summary>
65        public bool Marker
66        {
67            get
68            {
69                return _chartXmlHelper.GetXmlNodeBool(MARKER_PATH, false);
70            }
71            set
72            {
73                _chartXmlHelper.SetXmlNodeBool(MARKER_PATH, value, false);
74            }
75        }
76
77        string SMOOTH_PATH = "c:smooth/@val";
78        /// <summary>
79        /// If the series has smooth lines
80        /// </summary>
81        public bool Smooth
82        {
83            get
84            {
85                return _chartXmlHelper.GetXmlNodeBool(SMOOTH_PATH, false);
86            }
87            set
88            {
89                _chartXmlHelper.SetXmlNodeBool(SMOOTH_PATH, value);
90            }
91        }
92        //string _chartTopPath = "c:chartSpace/c:chart/c:plotArea/{0}";
93        ExcelChartDataLabel _DataLabel = null;
94        /// <summary>
95        /// Access to datalabel properties
96        /// </summary>
97        public ExcelChartDataLabel DataLabel
98        {
99            get
100            {
101                if (_DataLabel == null)
102                {
103                    _DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
104                }
105                return _DataLabel;
106            }
107        }
108        internal override eChartType GetChartType(string name)
109        {
110               if(name=="lineChart")
111               {
112                   if(Marker)
113                   {
114                       if(Grouping==eGrouping.Stacked)
115                       {
116                           return eChartType.LineMarkersStacked;
117                       }
118                       else if (Grouping == eGrouping.PercentStacked)
119                       {
120                           return eChartType.LineMarkersStacked100;
121                       }
122                       else
123                       {
124                           return eChartType.LineMarkers;
125                       }
126                   }
127                   else
128                   {
129                       if(Grouping==eGrouping.Stacked)
130                       {
131                           return eChartType.LineStacked;
132                       }
133                       else if (Grouping == eGrouping.PercentStacked)
134                       {
135                           return eChartType.LineStacked100;
136                       }
137                       else
138                       {
139                           return eChartType.Line;
140                       }
141                   }
142               }
143               else if (name=="line3DChart")
144               {
145                   return eChartType.Line3D;               
146               }
147               return base.GetChartType(name);
148        }
149    }
150}
Note: See TracBrowser for help on using the repository browser.