Aspose::Words::Drawing::Charts::AxisTickLabels class
Contents
[
Hide
]AxisTickLabels class
Represents properties of axis tick mark labels.
class AxisTickLabels : public Aspose::Words::Drawing::Charts::Core::IChartItemTextProperties
Methods
Method | Description |
---|---|
get_Alignment() | Gets or sets text alignment of the axis tick labels. |
get_Font() | Provides access to font formatting of the tick labels. |
get_IsAutoSpacing() | Gets or sets a flag indicating whether to use automatic interval for drawing the tick labels. |
get_Offset() | Gets or sets the distance of the tick labels from the axis. |
get_Orientation() | Gets or sets the orientation of the tick label text. |
get_Position() | Gets or sets the position of the tick labels on the axis. |
get_Rotation() | Gets or sets the rotation of the tick labels in degrees. |
get_Spacing() | Gets or sets the interval at which the tick labels are drawn. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
set_Alignment(Aspose::Words::ParagraphAlignment) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_Alignment. |
set_IsAutoSpacing(bool) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_IsAutoSpacing. |
set_Offset(int32_t) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_Offset. |
set_Orientation(Aspose::Words::Drawing::ShapeTextOrientation) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_Orientation. |
set_Position(Aspose::Words::Drawing::Charts::AxisTickLabelPosition) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_Position. |
set_Rotation(int32_t) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_Rotation. |
set_Spacing(int32_t) | Setter for Aspose::Words::Drawing::Charts::AxisTickLabels::get_Spacing. |
static Type() |
Examples
Shows how to insert a chart and modify the appearance of its axes.
auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertChart(Aspose::Words::Drawing::Charts::ChartType::Column, 500, 300);
System::SharedPtr<Aspose::Words::Drawing::Charts::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", System::MakeArray<System::String>({u"Word", u"PDF", u"Excel", u"GoogleDocs", u"Note"}), System::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.
System::SharedPtr<Aspose::Words::Drawing::Charts::ChartAxis> xAxis = chart->get_AxisX();
xAxis->set_CategoryType(Aspose::Words::Drawing::Charts::AxisCategoryType::Category);
xAxis->set_Crosses(Aspose::Words::Drawing::Charts::AxisCrosses::Minimum);
xAxis->set_ReverseOrder(false);
xAxis->set_MajorTickMark(Aspose::Words::Drawing::Charts::AxisTickMark::Inside);
xAxis->set_MinorTickMark(Aspose::Words::Drawing::Charts::AxisTickMark::Cross);
xAxis->set_MajorUnit(10.0);
xAxis->set_MinorUnit(15.0);
xAxis->get_TickLabels()->set_Offset(50);
xAxis->get_TickLabels()->set_Position(Aspose::Words::Drawing::Charts::AxisTickLabelPosition::Low);
xAxis->get_TickLabels()->set_IsAutoSpacing(false);
xAxis->set_TickMarkSpacing(1);
ASPOSE_ASSERT_EQ(doc, xAxis->get_Document());
System::SharedPtr<Aspose::Words::Drawing::Charts::ChartAxis> yAxis = chart->get_AxisY();
yAxis->set_CategoryType(Aspose::Words::Drawing::Charts::AxisCategoryType::Automatic);
yAxis->set_Crosses(Aspose::Words::Drawing::Charts::AxisCrosses::Maximum);
yAxis->set_ReverseOrder(true);
yAxis->set_MajorTickMark(Aspose::Words::Drawing::Charts::AxisTickMark::Inside);
yAxis->set_MinorTickMark(Aspose::Words::Drawing::Charts::AxisTickMark::Cross);
yAxis->set_MajorUnit(100.0);
yAxis->set_MinorUnit(20.0);
yAxis->get_TickLabels()->set_Position(Aspose::Words::Drawing::Charts::AxisTickLabelPosition::NextToAxis);
yAxis->get_TickLabels()->set_Alignment(Aspose::Words::ParagraphAlignment::Center);
yAxis->get_TickLabels()->get_Font()->set_Color(System::Drawing::Color::get_Red());
yAxis->get_TickLabels()->set_Spacing(1);
// Column charts do not have a Z-axis.
ASSERT_TRUE(System::TestTools::IsNull(chart->get_AxisZ()));
doc->Save(get_ArtifactsDir() + u"Charts.AxisProperties.docx");
See Also
- Namespace Aspose::Words::Drawing::Charts
- Library Aspose.Words for C++