Aspose::Words::Drawing::Charts::ChartDataLabel::set_Rotation method

ChartDataLabel::set_Rotation method

Sets the rotation of the label in degrees.

void Aspose::Words::Drawing::Charts::ChartDataLabel::set_Rotation(int32_t value)

Remarks

The range of acceptable values is from -180 to 180 inclusive. The default value is 0.

If the Orientation value is Horizontal, the label shape, if it exists, is rotated along with the label text. Otherwise, only the label text is rotated.

Examples

Shows how to change orientation and rotation for data labels.

auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);

System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertChart(ChartType::Column, static_cast<double>(432), static_cast<double>(252));
System::SharedPtr<Aspose::Words::Drawing::Charts::ChartSeries> series = shape->get_Chart()->get_Series()->idx_get(0);
System::SharedPtr<Aspose::Words::Drawing::Charts::ChartDataLabelCollection> dataLabels = series->get_DataLabels();

// Show data labels.
series->set_HasDataLabels(true);
dataLabels->set_ShowValue(true);
dataLabels->set_ShowCategoryName(true);

// Define data label shape.
dataLabels->get_Format()->set_ShapeType(ChartShapeType::UpArrow);
dataLabels->get_Format()->get_Stroke()->get_Fill()->Solid(System::Drawing::Color::get_DarkBlue());

// Set data label orientation and rotation for the entire series.
dataLabels->set_Orientation(ShapeTextOrientation::VerticalFarEast);
dataLabels->set_Rotation(-45);

// Change orientation and rotation of the first data label.
dataLabels->idx_get(0)->set_Orientation(ShapeTextOrientation::Horizontal);
dataLabels->idx_get(0)->set_Rotation(45);

doc->Save(get_ArtifactsDir() + u"Charts.LabelOrientationRotation.docx");

See Also