search/mag_sel search/close
Aspose::Words::Drawing::Charts::AxisScaling Class Reference

Represents the scaling options of the axis.

Examples

Shows how to apply logarithmic scaling to a chart axis.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> chartShape = builder->InsertChart(ChartType::Scatter, 450, 300);
SharedPtr<Chart> chart = chartShape->get_Chart();
// Clear the chart's demo data series to start with a clean chart.
chart->get_Series()->Clear();
// Insert a series with X/Y coordinates for five points.
chart->get_Series()->Add(u"Series 1", MakeArray<double>({1.0, 2.0, 3.0, 4.0, 5.0}), MakeArray<double>({1.0, 20.0, 400.0, 8000.0, 160000.0}));
// The scaling of the X-axis is linear by default,
// displaying evenly incrementing values that cover our X-value range (0, 1, 2, 3...).
// A linear axis is not ideal for our Y-values
// since the points with the smaller Y-values will be harder to read.
// A logarithmic scaling with a base of 20 (1, 20, 400, 8000...)
// will spread the plotted points, allowing us to read their values on the chart more easily.
chart->get_AxisY()->get_Scaling()->set_Type(AxisScaleType::Logarithmic);
chart->get_AxisY()->get_Scaling()->set_LogBase(20);
doc->Save(ArtifactsDir + u"Charts.AxisScaling.docx");

#include <Aspose.Words.Cpp/Drawing/Charts/AxisScaling.h>

+ Inheritance diagram for Aspose::Words::Drawing::Charts::AxisScaling:

Public Member Functions

 AxisScaling ()
 
SharedPtr< Aspose::Collections::StringToObjDictionary< SharedPtr< Aspose::Words::Drawing::Core::Dml::DmlExtension > > > get_Extensions () override
 
double get_LogBase () const
 Gets or sets the logarithmic base for a logarithmic axis. More...
 
SharedPtr< AxisBoundget_Maximum ()
 Gets or sets the maximum value of the axis. More...
 
SharedPtr< AxisBoundget_Minimum ()
 Gets or sets minimum value of the axis. More...
 
AxisScaleType get_Type () const
 Gets or sets scaling type of the axis. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_Extensions (SharedPtr< Aspose::Collections::StringToObjDictionary< SharedPtr< Aspose::Words::Drawing::Core::Dml::DmlExtension >>> value) override
 
void set_LogBase (double value)
 Setter for get_LogBase. More...
 
void set_Maximum (SharedPtr< AxisBound > value)
 Setter for get_Maximum. More...
 
void set_Minimum (SharedPtr< AxisBound > value)
 Setter for get_Minimum. More...
 
void set_Type (AxisScaleType value)
 Setter for get_Type. More...
 

Static Public Member Functions

static const TypeInfoType ()
 

Constructor & Destructor Documentation

◆ AxisScaling()

Aspose::Words::Drawing::Charts::AxisScaling::AxisScaling ( )

Member Function Documentation

◆ get_Extensions()

System::SharedPtr<Aspose::Collections::StringToObjDictionary<System::SharedPtr<Aspose::Words::Drawing::Core::Dml::DmlExtension> > > Aspose::Words::Drawing::Charts::AxisScaling::get_Extensions ( )
override

◆ get_LogBase()

double Aspose::Words::Drawing::Charts::AxisScaling::get_LogBase ( ) const

Gets or sets the logarithmic base for a logarithmic axis.

The property is not supported by MS Office 2016 new charts.

Valid range of a floating point value is greater than or equal to 2 and less than or equal to 1000. The property has effect only if Type is set to Logarithmic.

Setting this property sets the Type property to Logarithmic.

Examples

Shows how to apply logarithmic scaling to a chart axis.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> chartShape = builder->InsertChart(ChartType::Scatter, 450, 300);
SharedPtr<Chart> chart = chartShape->get_Chart();
// Clear the chart's demo data series to start with a clean chart.
chart->get_Series()->Clear();
// Insert a series with X/Y coordinates for five points.
chart->get_Series()->Add(u"Series 1", MakeArray<double>({1.0, 2.0, 3.0, 4.0, 5.0}), MakeArray<double>({1.0, 20.0, 400.0, 8000.0, 160000.0}));
// The scaling of the X-axis is linear by default,
// displaying evenly incrementing values that cover our X-value range (0, 1, 2, 3...).
// A linear axis is not ideal for our Y-values
// since the points with the smaller Y-values will be harder to read.
// A logarithmic scaling with a base of 20 (1, 20, 400, 8000...)
// will spread the plotted points, allowing us to read their values on the chart more easily.
chart->get_AxisY()->get_Scaling()->set_Type(AxisScaleType::Logarithmic);
chart->get_AxisY()->get_Scaling()->set_LogBase(20);
doc->Save(ArtifactsDir + u"Charts.AxisScaling.docx");

◆ get_Maximum()

System::SharedPtr<Aspose::Words::Drawing::Charts::AxisBound> Aspose::Words::Drawing::Charts::AxisScaling::get_Maximum ( )

Gets or sets the maximum value of the axis.

Examples

Shows how to insert chart with date/time values.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 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();
// Add a custom series containing date/time values for the X-axis, and respective decimal values for the Y-axis.
chart->get_Series()->Add(u"Aspose Test Series",
MakeArray<System::DateTime>({System::DateTime(2017, 11, 6), System::DateTime(2017, 11, 9), System::DateTime(2017, 11, 15),
System::DateTime(2017, 11, 21), System::DateTime(2017, 11, 25), System::DateTime(2017, 11, 29)}),
MakeArray<double>({1.2, 0.3, 2.1, 2.9, 4.2, 5.3}));
// Set lower and upper bounds for the X-axis.
SharedPtr<ChartAxis> xAxis = chart->get_AxisX();
xAxis->get_Scaling()->set_Minimum(MakeObject<AxisBound>(System::DateTime(2017, 11, 5).ToOADate()));
xAxis->get_Scaling()->set_Maximum(MakeObject<AxisBound>(System::DateTime(2017, 12, 3)));
// Set the major units of the X-axis to a week, and the minor units to a day.
xAxis->set_BaseTimeUnit(AxisTimeUnit::Days);
xAxis->set_MajorUnit(7.0);
xAxis->set_MajorTickMark(AxisTickMark::Cross);
xAxis->set_MinorUnit(1.0);
xAxis->set_MinorTickMark(AxisTickMark::Outside);
// Define Y-axis properties for decimal values.
SharedPtr<ChartAxis> yAxis = chart->get_AxisY();
yAxis->set_TickLabelPosition(AxisTickLabelPosition::High);
yAxis->set_MajorUnit(100.0);
yAxis->set_MinorUnit(50.0);
yAxis->get_DisplayUnit()->set_Unit(AxisBuiltInUnit::Hundreds);
yAxis->get_Scaling()->set_Minimum(MakeObject<AxisBound>(100.0));
yAxis->get_Scaling()->set_Maximum(MakeObject<AxisBound>(700.0));
doc->Save(ArtifactsDir + u"Charts.DateTimeValues.docx");

◆ get_Minimum()

System::SharedPtr<Aspose::Words::Drawing::Charts::AxisBound> Aspose::Words::Drawing::Charts::AxisScaling::get_Minimum ( )

Gets or sets minimum value of the axis.

Examples

Shows how to insert chart with date/time values.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 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();
// Add a custom series containing date/time values for the X-axis, and respective decimal values for the Y-axis.
chart->get_Series()->Add(u"Aspose Test Series",
MakeArray<System::DateTime>({System::DateTime(2017, 11, 6), System::DateTime(2017, 11, 9), System::DateTime(2017, 11, 15),
System::DateTime(2017, 11, 21), System::DateTime(2017, 11, 25), System::DateTime(2017, 11, 29)}),
MakeArray<double>({1.2, 0.3, 2.1, 2.9, 4.2, 5.3}));
// Set lower and upper bounds for the X-axis.
SharedPtr<ChartAxis> xAxis = chart->get_AxisX();
xAxis->get_Scaling()->set_Minimum(MakeObject<AxisBound>(System::DateTime(2017, 11, 5).ToOADate()));
xAxis->get_Scaling()->set_Maximum(MakeObject<AxisBound>(System::DateTime(2017, 12, 3)));
// Set the major units of the X-axis to a week, and the minor units to a day.
xAxis->set_BaseTimeUnit(AxisTimeUnit::Days);
xAxis->set_MajorUnit(7.0);
xAxis->set_MajorTickMark(AxisTickMark::Cross);
xAxis->set_MinorUnit(1.0);
xAxis->set_MinorTickMark(AxisTickMark::Outside);
// Define Y-axis properties for decimal values.
SharedPtr<ChartAxis> yAxis = chart->get_AxisY();
yAxis->set_TickLabelPosition(AxisTickLabelPosition::High);
yAxis->set_MajorUnit(100.0);
yAxis->set_MinorUnit(50.0);
yAxis->get_DisplayUnit()->set_Unit(AxisBuiltInUnit::Hundreds);
yAxis->get_Scaling()->set_Minimum(MakeObject<AxisBound>(100.0));
yAxis->get_Scaling()->set_Maximum(MakeObject<AxisBound>(700.0));
doc->Save(ArtifactsDir + u"Charts.DateTimeValues.docx");

◆ get_Type()

Aspose::Words::Drawing::Charts::AxisScaleType Aspose::Words::Drawing::Charts::AxisScaling::get_Type ( ) const

Gets or sets scaling type of the axis.

Examples

Shows how to apply logarithmic scaling to a chart axis.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> chartShape = builder->InsertChart(ChartType::Scatter, 450, 300);
SharedPtr<Chart> chart = chartShape->get_Chart();
// Clear the chart's demo data series to start with a clean chart.
chart->get_Series()->Clear();
// Insert a series with X/Y coordinates for five points.
chart->get_Series()->Add(u"Series 1", MakeArray<double>({1.0, 2.0, 3.0, 4.0, 5.0}), MakeArray<double>({1.0, 20.0, 400.0, 8000.0, 160000.0}));
// The scaling of the X-axis is linear by default,
// displaying evenly incrementing values that cover our X-value range (0, 1, 2, 3...).
// A linear axis is not ideal for our Y-values
// since the points with the smaller Y-values will be harder to read.
// A logarithmic scaling with a base of 20 (1, 20, 400, 8000...)
// will spread the plotted points, allowing us to read their values on the chart more easily.
chart->get_AxisY()->get_Scaling()->set_Type(AxisScaleType::Logarithmic);
chart->get_AxisY()->get_Scaling()->set_LogBase(20);
doc->Save(ArtifactsDir + u"Charts.AxisScaling.docx");

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Drawing::Charts::AxisScaling::GetType ( ) const
overridevirtual

◆ Is()

virtual bool Aspose::Words::Drawing::Charts::AxisScaling::Is ( const System::TypeInfo target) const
overridevirtual

◆ set_Extensions()

void Aspose::Words::Drawing::Charts::AxisScaling::set_Extensions ( System::SharedPtr< Aspose::Collections::StringToObjDictionary< System::SharedPtr< Aspose::Words::Drawing::Core::Dml::DmlExtension >>>  value)
override

◆ set_LogBase()

void Aspose::Words::Drawing::Charts::AxisScaling::set_LogBase ( double  value)

◆ set_Maximum()

void Aspose::Words::Drawing::Charts::AxisScaling::set_Maximum ( System::SharedPtr< Aspose::Words::Drawing::Charts::AxisBound value)

◆ set_Minimum()

void Aspose::Words::Drawing::Charts::AxisScaling::set_Minimum ( System::SharedPtr< Aspose::Words::Drawing::Charts::AxisBound value)

◆ set_Type()

void Aspose::Words::Drawing::Charts::AxisScaling::set_Type ( Aspose::Words::Drawing::Charts::AxisScaleType  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Drawing::Charts::AxisScaling::Type ( )
static