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/ExcelRadarChart.cs @ 17852

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

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 5.3 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.Globalization;
35using System.Text;
36using System.Xml;
37using OfficeOpenXml.Table.PivotTable;
38
39namespace OfficeOpenXml.Drawing.Chart
40{
41    /// <summary>
42    /// Provides access to line chart specific properties
43    /// </summary>
44    public class ExcelRadarChart : ExcelChart
45    {
46        #region "Constructors"
47        internal ExcelRadarChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
48            base(drawings, node, uriChart, part, chartXml, chartNode)
49        {
50            SetTypeProperties();
51        }
52
53        internal ExcelRadarChart(ExcelChart topChart, XmlNode chartNode) :
54            base(topChart, chartNode)
55        {
56            SetTypeProperties();
57        }
58        internal ExcelRadarChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
59            base(drawings, node, type, topChart, PivotTableSource)
60        {
61            SetTypeProperties();
62        }
63        #endregion
64        private void SetTypeProperties()
65        {
66            if (ChartType == eChartType.RadarFilled)
67            {
68                RadarStyle = eRadarStyle.Filled;
69            }
70            else if  (ChartType == eChartType.RadarMarkers)
71            {
72                RadarStyle =  eRadarStyle.Marker;
73            }
74            else
75            {
76                RadarStyle = eRadarStyle.Standard;
77            }
78        }
79
80        string STYLE_PATH = "c:radarStyle/@val";
81        /// <summary>
82        /// The type of radarchart
83        /// </summary>
84        public eRadarStyle RadarStyle
85        {
86            get
87            {
88                var v=_chartXmlHelper.GetXmlNodeString(STYLE_PATH);
89                if (string.IsNullOrEmpty(v))
90                {
91                    return eRadarStyle.Standard;
92                }
93                else
94                {
95                    return (eRadarStyle)Enum.Parse(typeof(eRadarStyle), v, true);
96                }
97            }
98            set
99            {
100                _chartXmlHelper.SetXmlNodeString(STYLE_PATH, value.ToString().ToLower(CultureInfo.InvariantCulture));
101            }
102        }
103
104        //string SMOOTH_PATH = "c:smooth/@val";
105        ///// <summary>
106        ///// If the series has smooth lines
107        ///// </summary>
108        //public bool Smooth
109        //{
110        //    get
111        //    {
112        //        return _chartXmlHelper.GetXmlNodeBool(SMOOTH_PATH, false);
113        //    }
114        //    set
115        //    {
116        //        _chartXmlHelper.SetXmlNodeBool(SMOOTH_PATH, value);
117        //    }
118        //}
119        //string _chartTopPath = "c:chartSpace/c:chart/c:plotArea/{0}";
120        ExcelChartDataLabel _DataLabel = null;
121        /// <summary>
122        /// Access to datalabel properties
123        /// </summary>
124        public ExcelChartDataLabel DataLabel
125        {
126            get
127            {
128                if (_DataLabel == null)
129                {
130                    _DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
131                }
132                return _DataLabel;
133            }
134        }
135        internal override eChartType GetChartType(string name)
136        {
137            if (RadarStyle == eRadarStyle.Filled)
138            {
139                return eChartType.RadarFilled;
140            }
141            else if (RadarStyle == eRadarStyle.Marker)
142            {
143                return eChartType.RadarMarkers;
144            }
145            else
146            {
147                return eChartType.Radar;
148            }
149        }
150    }
151}
Note: See TracBrowser for help on using the repository browser.