Ejemplo n.º 1
0
        private ValueAxis AppendValueAxis()
        {
            ChartSpace chartSpace = this.chartPart.ChartSpace;
            Chart      chart      = chartSpace.GetFirstChild <Chart>() ?? chartSpace.AppendChild(new Chart());
            PlotArea   plotArea   = chart.GetFirstChild <PlotArea>() ?? chart.AppendChild(new PlotArea());

            uint id = plotArea.Elements <ValueAxis>().Select(axis => axis.AxisId.Val.Value).DefaultIfEmpty(417314071u).Max() + 1;

            ValueAxis valueAxis = plotArea.AppendChild(
                new ValueAxis()
            {
                AxisId = new AxisId()
                {
                    Val = id
                },
                Scaling = new Scaling()
                {
                    Orientation = new Orientation()
                    {
                        Val = OrientationValues.MinMax
                    }
                },
                Delete = new Delete()
                {
                    Val = false
                },
                AxisPosition = new AxisPosition()
                {
                    Val = AxisPositionValues.Left
                },
                MajorGridlines = new MajorGridlines()
                {
                    ChartShapeProperties = new ChartShapeProperties()
                    {
                        // TODO
                    }
                },
                NumberingFormat = new NumberingFormat()
                {
                    FormatCode = "General", SourceLinked = true
                },
                MajorTickMark = new MajorTickMark()
                {
                    Val = TickMarkValues.None
                },
                MinorTickMark = new MinorTickMark()
                {
                    Val = TickMarkValues.None
                },
                TickLabelPosition = new TickLabelPosition()
                {
                    Val = TickLabelPositionValues.NextTo
                },
                ChartShapeProperties = new ChartShapeProperties()
                                       .AppendChildFluent(new Drawing.NoFill())
                                       .AppendChildFluent(new Drawing.Outline().AppendChildFluent(new Drawing.NoFill()))
                                       .AppendChildFluent(new Drawing.EffectList()),
                TextProperties = new TextProperties()
                {
                    BodyProperties = new Drawing.BodyProperties(),
                    ListStyle      = new Drawing.ListStyle()
                }
                .AppendChildFluent(
                    new Drawing.Paragraph()
                {
                    ParagraphProperties = new Drawing.ParagraphProperties().AppendChildFluent(
                        new Drawing.DefaultRunProperties()
                    {
                        FontSize  = 1197,
                        Bold      = false,
                        Italic    = false,
                        Underline = Drawing.TextUnderlineValues.None,
                        Strike    = Drawing.TextStrikeValues.NoStrike,
                        Kerning   = 1200,
                        Baseline  = 0
                    }
                        .AppendChildFluent(
                            new Drawing.SolidFill()
                    {
                        SchemeColor = new Drawing.SchemeColor()
                        {
                            Val = Drawing.SchemeColorValues.Text1
                        }
                        .AppendChildFluent(new Drawing.LuminanceModulation()
                        {
                            Val = 65000
                        })
                        .AppendChildFluent(new Drawing.LuminanceOffset()
                        {
                            Val = 35000
                        })
                    }
                            )
                        .AppendChildFluent(new Drawing.LatinFont()
                    {
                        Typeface = "+mn-lt"
                    })
                        .AppendChildFluent(new Drawing.EastAsianFont()
                    {
                        Typeface = "+mn-ea"
                    })
                        .AppendChildFluent(new Drawing.ComplexScriptFont()
                    {
                        Typeface = "+mn-cs"
                    })
                        )
                }
                    )
            }
                .AppendChildFluent(new Crosses()
            {
                Val = CrossesValues.AutoZero
            })
                .AppendChildFluent(new CrossBetween()
            {
                Val = CrossBetweenValues.Between
            })
                );

            return(valueAxis);
        }