Aspose::Words::Drawing::Charts::AxisScaling class

AxisScaling class

Represents the scaling options of the axis. To learn more, visit the Working with Charts documentation article.

class AxisScaling : public Aspose::Words::Drawing::Core::Dml::IDmlExtensionListSource

Methods

MethodDescription
AxisScaling()
get_LogBase() constGets or sets the logarithmic base for a logarithmic axis.
get_Maximum()Gets or sets the maximum value of the axis.
get_Minimum()Gets or sets minimum value of the axis.
get_Type() constGets or sets scaling type of the axis.
GetType() const override
Is(const System::TypeInfo&) const override
set_LogBase(double)Setter for Aspose::Words::Drawing::Charts::AxisScaling::get_LogBase.
set_Maximum(const System::SharedPtr<Aspose::Words::Drawing::Charts::AxisBound>&)Setter for Aspose::Words::Drawing::Charts::AxisScaling::get_Maximum.
set_Minimum(const System::SharedPtr<Aspose::Words::Drawing::Charts::AxisBound>&)Setter for Aspose::Words::Drawing::Charts::AxisScaling::get_Minimum.
set_Type(Aspose::Words::Drawing::Charts::AxisScaleType)Setter for Aspose::Words::Drawing::Charts::AxisScaling::get_Type.
static Type()

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");

See Also