Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2839_HiveProjectManagement/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChart.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: 4.9 KB
Line 
1using System.Globalization;
2using OfficeOpenXml.Packaging;
3using OfficeOpenXml.Table.PivotTable;
4using System;
5using System.Collections.Generic;
6using System.Linq;
7using System.Text;
8using System.Xml;
9
10namespace OfficeOpenXml.Drawing.Chart
11{
12    /// <summary>
13    /// Provides access to bubble chart specific properties
14    /// </summary>
15    public sealed class ExcelBubbleChart : ExcelChart
16    {
17        internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
18            base(drawings, node, type, topChart, PivotTableSource)
19        {
20            ShowNegativeBubbles = false;
21            BubbleScale = 100;
22            _chartSeries = new ExcelBubbleChartSeries(this, drawings.NameSpaceManager, _chartNode, PivotTableSource!=null);
23            //SetTypeProperties();
24        }
25
26        internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
27            base(drawings, node, type, isPivot)
28        {
29            _chartSeries = new ExcelBubbleChartSeries(this, drawings.NameSpaceManager, _chartNode, isPivot);
30            //SetTypeProperties();
31        }
32        internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
33            base(drawings, node, uriChart, part, chartXml, chartNode)
34        {
35            _chartSeries = new ExcelBubbleChartSeries(this, _drawings.NameSpaceManager, _chartNode, false);
36            //SetTypeProperties();
37        }
38        internal ExcelBubbleChart(ExcelChart topChart, XmlNode chartNode) :
39            base(topChart, chartNode)
40        {
41            _chartSeries = new ExcelBubbleChartSeries(this, _drawings.NameSpaceManager, _chartNode, false);
42        }
43        string BUBBLESCALE_PATH = "c:bubbleScale/@val";
44        /// <summary>
45        /// Specifies the scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
46        /// </summary>
47        public int BubbleScale
48        {
49            get
50            {
51                return _chartXmlHelper.GetXmlNodeInt(BUBBLESCALE_PATH);
52            }
53            set
54            {
55                if(value < 0 && value > 300)
56                {
57                    throw(new ArgumentOutOfRangeException("Bubblescale out of range. 0-300 allowed"));
58                }
59                _chartXmlHelper.SetXmlNodeString(BUBBLESCALE_PATH, value.ToString());
60            }
61        }
62        string SHOWNEGBUBBLES_PATH = "c:showNegBubbles/@val";
63        /// <summary>
64        /// Specifies the scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
65        /// </summary>
66        public bool ShowNegativeBubbles
67        {
68            get
69            {
70                return _chartXmlHelper.GetXmlNodeBool(SHOWNEGBUBBLES_PATH);
71            }
72            set
73            {
74                _chartXmlHelper.SetXmlNodeBool(BUBBLESCALE_PATH, value, true);
75            }
76        }
77        string BUBBLE3D_PATH = "c:bubble3D/@val";
78        /// <summary>
79        /// Specifies if the bubblechart is three dimensional
80        /// </summary>
81        public bool Bubble3D
82        {
83            get
84            {
85                return _chartXmlHelper.GetXmlNodeBool(BUBBLE3D_PATH);
86            }
87            set
88            {
89                _chartXmlHelper.SetXmlNodeBool(BUBBLE3D_PATH, value);
90                ChartType = value ? eChartType.Bubble3DEffect : eChartType.Bubble;
91            }
92        }
93        string SIZEREPRESENTS_PATH = "c:sizeRepresents/@val";
94        /// <summary>
95        /// Specifies the scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
96        /// </summary>
97        public eSizeRepresents SizeRepresents
98        {
99            get
100            {
101                var v = _chartXmlHelper.GetXmlNodeString(SIZEREPRESENTS_PATH).ToLower(CultureInfo.InvariantCulture);
102                if (v == "w")
103                {
104                    return eSizeRepresents.Width;
105                }
106                else
107                {
108                    return eSizeRepresents.Area;
109                }
110            }
111            set
112            {
113                _chartXmlHelper.SetXmlNodeString(SIZEREPRESENTS_PATH, value == eSizeRepresents.Width ? "w" : "area");
114            }
115        }
116        public new ExcelBubbleChartSeries Series
117        {
118            get
119            {
120
121                return (ExcelBubbleChartSeries)_chartSeries;
122            }
123        }
124        internal override eChartType GetChartType(string name)
125        {
126            if (Bubble3D)
127            {
128                return eChartType.Bubble3DEffect;
129            }
130            else
131            {
132                return eChartType.Bubble;
133            }
134        }
135    }
136}
Note: See TracBrowser for help on using the repository browser.