Free cookie consent management tool by TermsFeed Policy Generator

source: branches/LogResidualEvaluator/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/3.1.3/EPPlus-3.1.3/Drawing/Chart/ExcelScatterChart.cs @ 10202

Last change on this file since 10202 was 9580, checked in by sforsten, 12 years ago

#1730:

  • added SymbolicDataAnalysisExpressionExcelFormatter
  • changed modifiers in SymbolicExpressionTreeChart of methods SaveImageAsBitmap and SaveImageAsEmf to public
  • added menu item ExportSymbolicSolutionToExcelMenuItem to export a symbolic solution to an excel file
  • added EPPlus-3.1.3 to ExtLibs
File size: 6.2 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.IO.Packaging;
37using OfficeOpenXml.Table.PivotTable;
38
39namespace OfficeOpenXml.Drawing.Chart
40{
41    /// <summary>
42    /// Provides access to scatter chart specific properties
43    /// </summary>
44    public sealed class ExcelScatterChart : ExcelChart
45    {
46        internal ExcelScatterChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
47            base(drawings, node, type, topChart, PivotTableSource)
48        {
49            SetTypeProperties();
50        }
51
52        internal ExcelScatterChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, PackagePart part, XmlDocument chartXml, XmlNode chartNode) :
53            base(drawings, node, uriChart, part, chartXml, chartNode)
54        {
55            SetTypeProperties();
56        }
57
58        internal ExcelScatterChart(ExcelChart topChart, XmlNode chartNode) :
59            base(topChart, chartNode)
60        {
61            SetTypeProperties();
62        }
63        private void SetTypeProperties()
64        {
65           /***** ScatterStyle *****/
66           if(ChartType == eChartType.XYScatter ||
67              ChartType == eChartType.XYScatterLines ||
68              ChartType == eChartType.XYScatterLinesNoMarkers)
69           {
70               ScatterStyle = eScatterStyle.LineMarker;
71          }
72           else if (
73              ChartType == eChartType.XYScatterSmooth ||
74              ChartType == eChartType.XYScatterSmoothNoMarkers)
75           {
76               ScatterStyle = eScatterStyle.SmoothMarker;
77           }
78        }
79        #region "Grouping Enum Translation"
80        string _scatterTypePath = "c:scatterStyle/@val";
81        private eScatterStyle GetScatterEnum(string text)
82        {
83            switch (text)
84            {
85                case "smoothMarker":
86                    return eScatterStyle.SmoothMarker;
87                default:
88                    return eScatterStyle.LineMarker;
89            }
90        }
91
92        private string GetScatterText(eScatterStyle shatterStyle)
93        {
94            switch (shatterStyle)
95            {
96                case eScatterStyle.SmoothMarker:
97                    return "smoothMarker";
98                default:
99                    return "lineMarker";
100            }
101        }
102        #endregion
103        /// <summary>
104        /// If the scatter has LineMarkers or SmoothMarkers
105        /// </summary>
106        public eScatterStyle ScatterStyle
107        {
108            get
109            {
110                return GetScatterEnum(_chartXmlHelper.GetXmlNodeString(_scatterTypePath));
111            }
112            internal set
113            {
114                _chartXmlHelper.CreateNode(_scatterTypePath, true);
115                _chartXmlHelper.SetXmlNodeString(_scatterTypePath, GetScatterText(value));
116            }
117        }
118        string MARKER_PATH = "c:marker/@val";
119        /// <summary>
120        /// If the series has markers
121        /// </summary>
122        public bool Marker
123        {
124            get
125            {
126                return GetXmlNodeBool(MARKER_PATH, false);
127            }
128            set
129            {
130                SetXmlNodeBool(MARKER_PATH, value, false);
131            }
132        }
133
134        internal override eChartType GetChartType(string name)
135        {
136            if (name == "scatterChart")
137            {
138                if (ScatterStyle==eScatterStyle.LineMarker)
139                {
140                    if (((ExcelScatterChartSerie)Series[0]).Marker == eMarkerStyle.None)
141                    {
142                        return eChartType.XYScatterLinesNoMarkers;
143                    }
144                    else
145                    {
146                        if(ExistNode("c:ser/c:spPr/a:ln/noFill"))
147                        {
148                            return eChartType.XYScatter;
149                        }
150                        else
151                        {
152                            return eChartType.XYScatterLines;
153                        }
154                    }
155                }
156                else if (ScatterStyle == eScatterStyle.SmoothMarker)
157                {
158                    if (((ExcelScatterChartSerie)Series[0]).Marker == eMarkerStyle.None)
159                    {
160                        return eChartType.XYScatterSmoothNoMarkers;
161                    }
162                    else
163                    {
164                        return eChartType.XYScatterSmooth;
165                    }
166                }
167            }
168            return base.GetChartType(name);
169        }
170
171    }
172}
Note: See TracBrowser for help on using the repository browser.