AxisBound

AxisBound class

Represents minimum or maximum bound of axis values.

To learn more, visit the Working with Charts documentation article.

public sealed class AxisBound

Constructors

NameDescription
AxisBound()Creates a new instance indicating that axis bound should be determined automatically by a word-processing application.
AxisBound(DateTime)Creates an axis bound represented as datetime value.
AxisBound(double)Creates an axis bound represented as a number.

Properties

NameDescription
IsAuto { get; }Returns a flag indicating that axis bound should be determined automatically.
Value { get; }Returns numeric value of axis bound.
ValueAsDate { get; }Returns value of axis bound represented as datetime.

Methods

NameDescription
override Equals(object)Determines whether the specified object is equal in value to the current object.
override GetHashCode()Serves as a hash function for this type.
override ToString()Returns a user-friendly string that displays the value of this object.

Remarks

Bound can be specified as a numeric, datetime or a special “auto” value.

The instances of this class are immutable.

Examples

Shows how to insert chart with date/time values.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertChart(ChartType.Line, 500, 300);
Chart chart = shape.Chart;

// Clear the chart's demo data series to start with a clean chart.
chart.Series.Clear();

// Add a custom series containing date/time values for the X-axis, and respective decimal values for the Y-axis.
chart.Series.Add("Aspose Test Series",
    new[]
    {
        new DateTime(2017, 11, 06), new DateTime(2017, 11, 09), new DateTime(2017, 11, 15),
        new DateTime(2017, 11, 21), new DateTime(2017, 11, 25), new DateTime(2017, 11, 29)
    },
    new[] { 1.2, 0.3, 2.1, 2.9, 4.2, 5.3 });

// Set lower and upper bounds for the X-axis.
ChartAxis xAxis = chart.AxisX;
xAxis.Scaling.Minimum = new AxisBound(new DateTime(2017, 11, 05).ToOADate());
xAxis.Scaling.Maximum = new AxisBound(new DateTime(2017, 12, 03));

// Set the major units of the X-axis to a week, and the minor units to a day.
xAxis.BaseTimeUnit = AxisTimeUnit.Days;
xAxis.MajorUnit = 7.0d;
xAxis.MajorTickMark = AxisTickMark.Cross;
xAxis.MinorUnit = 1.0d;
xAxis.MinorTickMark = AxisTickMark.Outside;
xAxis.HasMajorGridlines = true;
xAxis.HasMinorGridlines = true;

// Define Y-axis properties for decimal values.
ChartAxis yAxis = chart.AxisY;
yAxis.TickLabels.Position = AxisTickLabelPosition.High;
yAxis.MajorUnit = 100.0d;
yAxis.MinorUnit = 50.0d;
yAxis.DisplayUnit.Unit = AxisBuiltInUnit.Hundreds;
yAxis.Scaling.Minimum = new AxisBound(100);
yAxis.Scaling.Maximum = new AxisBound(700);
yAxis.HasMajorGridlines = true;
yAxis.HasMinorGridlines = true;

doc.Save(ArtifactsDir + "Charts.DateTimeValues.docx");

See Also