Пример #1
0
        /// <summary>
        /// Add a new series to this chart
        /// </summary>
        public void AddSeries(Series series)
        {
            var seriesCount = ChartXml.Elements(XName.Get("ser", Document.c.NamespaceName)).Count();

            if (seriesCount >= MaxSeriesCount)
            {
                throw new InvalidOperationException("Maximum series for this chart is" + MaxSeriesCount.ToString() + "and have exceeded!");
            }

            //To work in Words, all series need an Index and Order.
            var value   = seriesCount + 1;
            var content = new XAttribute(XName.Get("val"), value.ToString());

            series.Xml.AddFirst(new XElement(XName.Get("order", Document.c.NamespaceName), content));
            series.Xml.AddFirst(new XElement(XName.Get("idx", Document.c.NamespaceName), content));
            this.ChartXml.Add(series.Xml);
        }
Пример #2
0
        public void AddSeries(Series series)
        {
            int num = ChartXml.Elements(XName.Get("ser", DocX.c.NamespaceName)).Count();

            if (num == MaxSeriesCount)
            {
                throw new InvalidOperationException("Maximum series for this chart is" + MaxSeriesCount.ToString() + "and have exceeded!");
            }
            series.Xml.AddFirst(new XElement(XName.Get("order", DocX.c.NamespaceName), new XAttribute(XName.Get("val"), (num + 1).ToString())));
            series.Xml.AddFirst(new XElement(XName.Get("idx", DocX.c.NamespaceName), new XAttribute(XName.Get("val"), (num + 1).ToString())));
            ChartXml.Add(series.Xml);
        }