ChartAxisMinorUnitIsAuto Property |
Namespace: Aspose.Words.Drawing.Charts
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a scatter chart, which is populated by default values Shape shape = builder.InsertChart(ChartType.Scatter, 450, 250); Chart chart = shape.Chart; // Set they Y axis to show major ticks every at every 10 units and minor ticks at every 1 units ChartAxis axis = chart.AxisY; axis.MajorTickMark = AxisTickMark.Outside; axis.MinorTickMark = AxisTickMark.Outside; axis.MajorUnit = 10.0; axis.MinorUnit = 1.0; // Stretch out the bounds of the axis out to show 3 major ticks and 27 minor ticks axis.Scaling.Minimum = new AxisBound(-10); axis.Scaling.Maximum = new AxisBound(20); // Do the same for the X-axis axis = chart.AxisX; axis.MajorTickMark = AxisTickMark.Inside; axis.MinorTickMark = AxisTickMark.Inside; axis.MajorUnit = 10.0; axis.Scaling.Minimum = new AxisBound(-10); axis.Scaling.Maximum = new AxisBound(30); // We can also use this attribute to set minor tick spacing axis.TickLabelSpacing = 2; // We can define text alignment when axis tick labels are multi-line // MS Word aligns them to the center by default axis.TickLabelAlignment = ParagraphAlignment.Right; // Get the axis to display values, but in millions axis.DisplayUnit.Unit = AxisBuiltInUnit.Millions; // Besides the built-in axis units we can choose from, // we can also set the axis to display values in some custom denomination, using the following attribute // The statement below is equivalent to the one above axis.DisplayUnit.CustomUnit = 1000000.0; doc.Save(ArtifactsDir + "Charts.ChartAxisDisplayUnit.docx");