Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GBT/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelDoughnutChart.cs @ 12329

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

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 4.9 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 System.Globalization;
37using OfficeOpenXml.Table.PivotTable;
38
39namespace OfficeOpenXml.Drawing.Chart
40{
41    /// <summary>
42    /// Provides access to doughnut chart specific properties
43    /// </summary>
44    public class ExcelDoughnutChart : ExcelPieChart
45    {
46        //internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node) :
47        //    base(drawings, node)
48        //{
49        //    SetPaths();
50        //}
51        internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
52            base(drawings, node, type, isPivot)
53        {
54            //SetPaths();
55        }
56        internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
57            base(drawings, node, type, topChart, PivotTableSource)
58        {
59            //SetPaths();
60        }
61        internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
62           base(drawings, node, uriChart, part, chartXml, chartNode)
63        {
64            //SetPaths();
65        }
66
67        internal ExcelDoughnutChart(ExcelChart topChart, XmlNode chartNode) :
68            base(topChart, chartNode)
69        {
70            //SetPaths();
71        }
72
73        //private void SetPaths()
74        //{
75        //    string chartNodeText = GetChartNodeText();
76        //    _firstSliceAngPath = string.Format(_firstSliceAngPath, chartNodeText);
77        //    _holeSizePath = string.Format(_holeSizePath, chartNodeText);
78        //}
79        //string _firstSliceAngPath = "c:chartSpace/c:chart/c:plotArea/{0}/c:firstSliceAng/@val";
80        string _firstSliceAngPath = "c:firstSliceAng/@val";
81        /// <summary>
82        /// Angle of the first slize
83        /// </summary>
84        public decimal FirstSliceAngle
85        {
86            get
87            {
88                return _chartXmlHelper.GetXmlNodeDecimal(_firstSliceAngPath);
89            }
90            internal set
91            {
92                _chartXmlHelper.SetXmlNodeString(_firstSliceAngPath, value.ToString(CultureInfo.InvariantCulture));
93            }
94        }
95        //string _holeSizePath = "c:chartSpace/c:chart/c:plotArea/{0}/c:holeSize/@val";
96        string _holeSizePath = "c:holeSize/@val";
97        /// <summary>
98        /// Size of the doubnut hole
99        /// </summary>
100        public decimal HoleSize
101        {
102            get
103            {
104                return _chartXmlHelper.GetXmlNodeDecimal(_holeSizePath);
105            }
106            internal set
107            {
108                _chartXmlHelper.SetXmlNodeString(_holeSizePath, value.ToString(CultureInfo.InvariantCulture));
109            }
110        }
111        internal override eChartType GetChartType(string name)
112        {
113            if (name == "doughnutChart")
114            {
115                if (((ExcelPieChartSerie)Series[0]).Explosion > 0)
116                {
117                    return eChartType.DoughnutExploded;
118                }
119                else
120                {
121                    return eChartType.Doughnut;
122                }
123            }
124            return base.GetChartType(name);
125        }
126    }
127}
Note: See TracBrowser for help on using the repository browser.