Aspose::Words::Drawing::Charts::ChartAxis class
Contents
[
Hide
]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
Method | Description |
---|---|
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 containing the parent chart. |
get_Format() | Provides access to line formatting of the axis and fill of the tick labels. |
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_TickLabels() | Provides access to the properties of the axis tick mark labels. |
get_TickMarkSpacing() | Gets or sets the interval, at which tick marks are drawn. |
get_Title() | Provides access to the axis title properties. |
get_Type() const | Returns 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_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->get_TickLabels()->set_Offset(50);
xAxis->get_TickLabels()->set_Position(AxisTickLabelPosition::Low);
xAxis->get_TickLabels()->set_IsAutoSpacing(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->get_TickLabels()->set_Position(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
- Namespace Aspose::Words::Drawing::Charts
- Library Aspose.Words for C++