Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChart.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.5 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    Added   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    /// A Surface chart
42    /// </summary>
43    public sealed class ExcelSurfaceChart : ExcelChart
44    {
45        #region "Constructors"
46        internal ExcelSurfaceChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
47            base(drawings, node, type, topChart, PivotTableSource)
48        {
49            Init();
50        }
51        internal ExcelSurfaceChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
52           base(drawings, node, uriChart, part, chartXml, chartNode)
53        {
54            Init();
55        }
56
57        internal ExcelSurfaceChart(ExcelChart topChart, XmlNode chartNode) :
58            base(topChart, chartNode)
59        {
60            Init();
61        }
62        private void Init()
63        {
64          _floor=new ExcelChartSurface(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode("c:floor", NameSpaceManager));
65            _backWall = new ExcelChartSurface(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode("c:sideWall", NameSpaceManager));
66            _sideWall = new ExcelChartSurface(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode("c:backWall", NameSpaceManager));
67            SetTypeProperties();
68        }
69        #endregion
70
71
72        ExcelChartSurface _floor;
73        public ExcelChartSurface Floor
74        {
75            get
76            {
77                return _floor;
78            }
79        }
80        ExcelChartSurface _sideWall;
81        public ExcelChartSurface SideWall
82        {
83            get
84            {
85                return _sideWall;
86            }
87        }
88        ExcelChartSurface _backWall;
89        public ExcelChartSurface BackWall
90        {
91            get
92            {
93                return _backWall;
94            }
95        }
96        const string WIREFRAME_PATH = "c:wireframe/@val";
97        public bool Wireframe
98        {
99            get
100            {
101                return _chartXmlHelper.GetXmlNodeBool(WIREFRAME_PATH);
102            }
103            set
104            {
105                _chartXmlHelper.SetXmlNodeBool(WIREFRAME_PATH, value);
106            }
107        }       
108        internal void SetTypeProperties()
109        {
110               if(ChartType==eChartType.SurfaceWireframe || ChartType==eChartType.SurfaceTopViewWireframe)
111               {
112                   Wireframe=true;
113               }
114               else
115               {
116                   Wireframe=false;
117               }
118
119                if(ChartType==eChartType.SurfaceTopView || ChartType==eChartType.SurfaceTopViewWireframe)
120                {
121                   View3D.RotY = 0;
122                   View3D.RotX = 90;
123                }
124                else
125                {
126                   View3D.RotY = 20;
127                   View3D.RotX = 15;
128                }
129                View3D.RightAngleAxes = false;
130                View3D.Perspective = 0;
131                Axis[1].CrossBetween = eCrossBetween.MidCat;
132        }
133        internal override eChartType GetChartType(string name)
134        {
135            if(Wireframe)
136            {
137                if (name == "surfaceChart")
138                {
139                    return eChartType.SurfaceTopViewWireframe;
140                }
141                else
142                {
143                    return eChartType.SurfaceWireframe;
144                }
145            }
146            else
147            {
148                if (name == "surfaceChart")
149                {
150                    return eChartType.SurfaceTopView;
151                }
152                else
153                {
154                    return eChartType.Surface;
155                }
156            }
157        }
158    }
159}
Note: See TracBrowser for help on using the repository browser.