protected DateAxis GenerateDateAxis(AxisId axisId, AxisPositionValues axisPosition, AxisId crossingAxisId, TickLabelPositionValues tickLabelPosition) { DateAxis dateAxis1 = new DateAxis(); AxisId axisId3 = new AxisId() { Val = axisId.Val }; Scaling scaling1 = new Scaling(); Orientation orientation1 = new Orientation() { Val = OrientationValues.MinMax }; scaling1.Append(orientation1); AxisPosition axisPosition1 = new AxisPosition() { Val = AxisPositionValues.Bottom }; NumberingFormat numberingFormat1 = new NumberingFormat() { FormatCode = dateAxisFormat, SourceLinked = true }; MajorTickMark majorTickMark1 = new MajorTickMark() { Val = TickMarkValues.None }; TickLabelPosition tickLabelPosition1 = new TickLabelPosition() { Val = tickLabelPosition }; TextProperties textProperties1 = new TextProperties(); A::BodyProperties bodyProperties2 = new A::BodyProperties() { Rotation = -5400000, Vertical = A::TextVerticalValues.Horizontal }; A::ListStyle listStyle2 = new A::ListStyle(); A::Paragraph paragraph2 = new A::Paragraph(); A::ParagraphProperties paragraphProperties2 = new A::ParagraphProperties(); A::DefaultRunProperties defaultRunProperties2 = new A::DefaultRunProperties() { Language = DEFAULT_LANG }; paragraphProperties2.Append(defaultRunProperties2); A::EndParagraphRunProperties endParagraphRunProperties1 = new A::EndParagraphRunProperties() { Language = DEFAULT_LANG }; paragraph2.Append(paragraphProperties2); paragraph2.Append(endParagraphRunProperties1); textProperties1.Append(bodyProperties2); textProperties1.Append(listStyle2); textProperties1.Append(paragraph2); CrossingAxis crossingAxis1 = new CrossingAxis() { Val = crossingAxisId.Val }; Crosses crosses1 = new Crosses() { Val = CrossesValues.AutoZero }; AutoLabeled autoLabeled1 = new AutoLabeled() { Val = true }; LabelOffset labelOffset1 = new LabelOffset() { Val = (UInt16Value)100U }; dateAxis1.Append(axisId3); dateAxis1.Append(scaling1); dateAxis1.Append(axisPosition1); dateAxis1.Append(numberingFormat1); dateAxis1.Append(majorTickMark1); dateAxis1.Append(tickLabelPosition1); dateAxis1.Append(textProperties1); dateAxis1.Append(crossingAxis1); dateAxis1.Append(crosses1); dateAxis1.Append(autoLabeled1); dateAxis1.Append(labelOffset1); return dateAxis1; }
private List <OpenXmlElement> GetAxisElements(uint id, String name, uint crossingAxisId, bool show = true, TickLabelPositionValues tickPosition = TickLabelPositionValues.NextTo) { var result = new List <OpenXmlElement>(); if (show) { result.Add(new Delete { Val = false }); } result.Add(new AxisId { Val = new UInt32Value(id) }); result.Add(new Scaling(new Orientation() { Val = new EnumValue <DocumentFormat.OpenXml.Drawing.Charts.OrientationValues>(DocumentFormat.OpenXml.Drawing.Charts.OrientationValues.MinMax) })); if (show) { result.Add(GenerateTitle(name)); } result.Add(new TickLabelPosition { Val = new EnumValue <TickLabelPositionValues>(tickPosition) }); result.Add(new CrossingAxis { Val = new UInt32Value(crossingAxisId) }); result.Add(new Crosses { Val = new EnumValue <CrossesValues>(CrossesValues.AutoZero) }); return(result); }
protected void AppendValueAxis(PlotArea plotArea, uint id, string name, uint crossingAxisId, AxisPositionValues axisPos = AxisPositionValues.Left, TickLabelPositionValues tickPos = TickLabelPositionValues.NextTo, bool showMajorGridlines = true) { List <OpenXmlElement> elements = GetAxisElements(id, name, crossingAxisId, tickPosition: tickPos); elements.Add(new AxisPosition { Val = new EnumValue <AxisPositionValues>(axisPos) }); if (showMajorGridlines) { elements.Add(new MajorGridlines()); } elements.Add(new DocumentFormat.OpenXml.Drawing.Charts.NumberingFormat() { FormatCode = new StringValue("General"), SourceLinked = new BooleanValue(true) }); elements.Add(new CrossBetween { Val = new EnumValue <CrossBetweenValues>(CrossBetweenValues.Between) }); plotArea.AppendChild(new ValueAxis(elements)); }