Aspose::Words::Drawing::Charts::ChartAxis::get_CrossesAt method

ChartAxis::get_CrossesAt method

Specifies where on the perpendicular axis the axis crosses.

double Aspose::Words::Drawing::Charts::ChartAxis::get_CrossesAt()

Remarks

The property has effect only if Crosses are set to Custom. It is not supported by MS Office 2016 new charts.

The units are determined by the type of axis. When the axis is a value axis, the value of the property is a decimal number on the value axis. When the axis is a time category axis, the value is defined as an integer number of days relative to the base date (30/12/1899). For a text category axis, the value is an integer category number, starting with 1 as the first category.

Examples

Shows how to get a graph axis to cross at a custom location.

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

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

ASSERT_EQ(3, chart->get_Series()->get_Count());
ASSERT_EQ(u"Series 1", chart->get_Series()->idx_get(0)->get_Name());
ASSERT_EQ(u"Series 2", chart->get_Series()->idx_get(1)->get_Name());
ASSERT_EQ(u"Series 3", chart->get_Series()->idx_get(2)->get_Name());

// For column charts, the Y-axis crosses at zero by default,
// which means that columns for all values below zero point down to represent negative values.
// We can set a different value for the Y-axis crossing. In this case, we will set it to 3.
SharedPtr<ChartAxis> axis = chart->get_AxisX();
axis->set_Crosses(AxisCrosses::Custom);
axis->set_CrossesAt(3);
axis->set_AxisBetweenCategories(true);

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

See Also