using System; using System.Xml.Linq; namespace Novacode { /// /// This element contains the 2-D bar or column series on this chart. /// 21.2.2.16 barChart (Bar Charts) /// public class BarChart : Chart { /// /// Specifies the possible directions for a bar chart. /// public BarDirection BarDirection { get { return XElementHelpers.GetValueToEnum( ChartXml.Element(XName.Get("barDir", DocX.c.NamespaceName))); } set { XElementHelpers.SetValueFromEnum( ChartXml.Element(XName.Get("barDir", DocX.c.NamespaceName)), value); } } /// /// Specifies the possible groupings for a bar chart. /// public BarGrouping BarGrouping { get { return XElementHelpers.GetValueToEnum( ChartXml.Element(XName.Get("grouping", DocX.c.NamespaceName))); } set { XElementHelpers.SetValueFromEnum( ChartXml.Element(XName.Get("grouping", DocX.c.NamespaceName)), value); } } /// /// Specifies that its contents contain a percentage between 0% and 500%. /// public Int32 GapWidth { get { return Convert.ToInt32( ChartXml.Element(XName.Get("gapWidth", DocX.c.NamespaceName)).Attribute(XName.Get("val")).Value); } set { if ((value < 1) || (value > 500)) throw new ArgumentException("GapWidth lay between 0% and 500%!"); ChartXml.Element(XName.Get("gapWidth", DocX.c.NamespaceName)).Attribute(XName.Get("val")).Value = value.ToString(); } } protected override XElement CreateChartXml() { return XElement.Parse( @" "); } } /// /// Specifies the possible directions for a bar chart. /// 21.2.3.3 ST_BarDir (Bar Direction) /// public enum BarDirection { [XmlName("col")] Column, [XmlName("bar")] Bar } /// /// Specifies the possible groupings for a bar chart. /// 21.2.3.4 ST_BarGrouping (Bar Grouping) /// public enum BarGrouping { [XmlName("clustered")] Clustered, [XmlName("percentStacked")] PercentStacked, [XmlName("stacked")] Stacked, [XmlName("standard")] Standard } }