/*************************************************************************************
DocX – DocX is the community edition of Xceed Words for .NET
Copyright (C) 2009-2016 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
For more features and fast professional support,
pick up Xceed Words for .NET at https://xceed.com/xceed-words-for-net/
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Xceed.Words.NET
{
///
/// This element contains the 2-D bar or column series on this chart.
/// 21.2.2.16 barChart (Bar Charts)
///
public class BarChart : Chart
{
#region Public Properties
///
/// 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();
}
}
public string Title
{
set
{
var t = new XElement(XE.A.CName("t"), value);
var rpr = new XElement(XE.A.CName("rPr"), XE.A.CAttr("lang", "zh-CN"), XE.A.CAttr("altLang", "en-US"));
var pPr = new XElement(XE.A.CName("pPr"),
XE.A.CAttr("defTabSz", "914400"),
XE.A.CElement("defRPr", new List