Aspose::Words::Drawing::Charts::ChartAxis class

ChartAxis class

Represents the axis options of the chart. To learn more, visit the Working with Charts documentation article.

class ChartAxis : public Aspose::Words::Drawing::Charts::Core::IDmlChartTitleHolder,
                  public Aspose::Words::Drawing::Core::Dml::IDmlExtensionListSource,
                  public Aspose::Words::Drawing::Charts::Core::INumberFormatProvider,
                  public Aspose::Words::Drawing::Charts::Core::IChartFormatSource

Methods

MethodDescription
get_AxisBetweenCategories()Gets or sets a flag indicating whether the value axis crosses the category axis between categories.
get_BaseTimeUnit()Returns or sets the smallest time unit that is represented on the time category axis.
get_CategoryType()Gets or sets type of the category axis.
get_Crosses()Specifies how this axis crosses the perpendicular axis.
get_CrossesAt()Specifies where on the perpendicular axis the axis crosses.
get_DisplayUnit()Specifies the scaling value of the display units for the value axis.
get_Document()Returns the Document the title holder belongs.
get_Format()
get_HasMajorGridlines()Gets a flag indicating whether the axis has major gridlines.
get_HasMinorGridlines()Gets a flag indicating whether the axis has minor gridlines.
get_Hidden()Gets or sets a flag indicating whether this axis is hidden or not.
get_MajorTickMark()Returns or sets the major tick marks.
get_MajorUnit()Returns or sets the distance between major tick marks.
get_MajorUnitIsAuto()Gets or sets a flag indicating whether default distance between major tick marks shall be used.
get_MajorUnitScale()Returns or sets the scale value for major tick marks on the time category axis.
get_MinorTickMark()Returns or sets the minor tick marks for the axis.
get_MinorUnit()Returns or sets the distance between minor tick marks.
get_MinorUnitIsAuto()Gets or sets a flag indicating whether default distance between minor tick marks shall be used.
get_MinorUnitScale()Returns or sets the scale value for minor tick marks on the time category axis.
get_NumberFormat()Returns a ChartNumberFormat object that allows defining number formats for the axis.
get_ReverseOrder()Returns or sets a flag indicating whether values of axis should be displayed in reverse order, i.e. from max to min.
get_Scaling()Provides access to the scaling options of the axis.
get_TickLabelAlignment()Gets or sets text alignment of axis tick labels.
get_TickLabelOffset()Gets or sets the distance of labels from the axis.
get_TickLabelPosition()Returns or sets the position of the tick labels on the axis.
get_TickLabels()
get_TickLabelSpacing()Gets or sets the interval, at which tick labels are drawn.
get_TickLabelSpacingIsAuto()Gets or sets a flag indicating whether automatic interval of drawing tick labels shall be used.
get_TickMarkSpacing()Gets or sets the interval, at which tick marks are drawn.
get_Title()
get_Type() constReturns type of the axis.
GetType() const override
Is(const System::TypeInfo&) const override
set_AxisBetweenCategories(bool)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_AxisBetweenCategories.
set_BaseTimeUnit(Aspose::Words::Drawing::Charts::AxisTimeUnit)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_BaseTimeUnit.
set_CategoryType(Aspose::Words::Drawing::Charts::AxisCategoryType)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_CategoryType.
set_Crosses(Aspose::Words::Drawing::Charts::AxisCrosses)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_Crosses.
set_CrossesAt(double)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_CrossesAt.
set_HasMajorGridlines(bool)Sets a flag indicating whether the axis has major gridlines.
set_HasMinorGridlines(bool)Sets a flag indicating whether the axis has minor gridlines.
set_Hidden(bool)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_Hidden.
set_MajorTickMark(Aspose::Words::Drawing::Charts::AxisTickMark)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MajorTickMark.
set_MajorUnit(double)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MajorUnit.
set_MajorUnitIsAuto(bool)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MajorUnitIsAuto.
set_MajorUnitScale(Aspose::Words::Drawing::Charts::AxisTimeUnit)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MajorUnitScale.
set_MinorTickMark(Aspose::Words::Drawing::Charts::AxisTickMark)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MinorTickMark.
set_MinorUnit(double)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MinorUnit.
set_MinorUnitIsAuto(bool)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MinorUnitIsAuto.
set_MinorUnitScale(Aspose::Words::Drawing::Charts::AxisTimeUnit)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_MinorUnitScale.
set_ReverseOrder(bool)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_ReverseOrder.
set_TickLabelAlignment(Aspose::Words::ParagraphAlignment)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_TickLabelAlignment.
set_TickLabelOffset(int32_t)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_TickLabelOffset.
set_TickLabelPosition(Aspose::Words::Drawing::Charts::AxisTickLabelPosition)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_TickLabelPosition.
set_TickLabelSpacing(int32_t)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_TickLabelSpacing.
set_TickLabelSpacingIsAuto(bool)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_TickLabelSpacingIsAuto.
set_TickMarkSpacing(int32_t)Setter for Aspose::Words::Drawing::Charts::ChartAxis::get_TickMarkSpacing.
static Type()

Examples

Shows how to insert a chart and modify the appearance of its axes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

SharedPtr<Shape> shape = builder->InsertChart(ChartType::Column, 500, 300);
SharedPtr<Chart> chart = shape->get_Chart();

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

// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart->get_Series()->Add(u"Aspose Test Series", MakeArray<String>({u"Word", u"PDF", u"Excel", u"GoogleDocs", u"Note"}),
                         MakeArray<double>({640, 320, 280, 120, 150}));

// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
SharedPtr<ChartAxis> xAxis = chart->get_AxisX();
xAxis->set_CategoryType(AxisCategoryType::Category);
xAxis->set_Crosses(AxisCrosses::Minimum);
xAxis->set_ReverseOrder(false);
xAxis->set_MajorTickMark(AxisTickMark::Inside);
xAxis->set_MinorTickMark(AxisTickMark::Cross);
xAxis->set_MajorUnit(10.0);
xAxis->set_MinorUnit(15.0);
xAxis->set_TickLabelOffset(50);
xAxis->set_TickLabelPosition(AxisTickLabelPosition::Low);
xAxis->set_TickLabelSpacingIsAuto(false);
xAxis->set_TickMarkSpacing(1);

SharedPtr<ChartAxis> yAxis = chart->get_AxisY();
yAxis->set_CategoryType(AxisCategoryType::Automatic);
yAxis->set_Crosses(AxisCrosses::Maximum);
yAxis->set_ReverseOrder(true);
yAxis->set_MajorTickMark(AxisTickMark::Inside);
yAxis->set_MinorTickMark(AxisTickMark::Cross);
yAxis->set_MajorUnit(100.0);
yAxis->set_MinorUnit(20.0);
yAxis->set_TickLabelPosition(AxisTickLabelPosition::NextToAxis);

// Column charts do not have a Z-axis.
ASSERT_TRUE(chart->get_AxisZ() == nullptr);

doc->Save(ArtifactsDir + u"Charts.AxisProperties.docx");

See Also