Aspose::Cells::Charts::Axis class
Contents
[
Hide
]Axis class
Encapsulates the object that represents an axis of chart.
class Axis
Methods
Method | Description |
---|---|
Axis(Axis_Impl* impl) | Constructs from an implementation object. |
Axis(const Axis& src) | Copy constructor. |
GetArea() | Gets the Area. |
GetAxisBetweenCategories() | Represents if the value axis crosses the category axis between categories. |
GetAxisLine() | Gets the appearance of an Axis. |
GetAxisTexts() | Gets the labels of the axis after call Chart.Calculate() method. |
GetBaseUnitScale() | Represents the base unit scale for the category axis. |
GetBins() | Represents bins on a chart(Histogram/Pareto) axis. |
GetCategoryType() | Represents the category axis type. |
GetCrossAt() | Represents the point on the value axis where the category axis crosses it. |
GetCrossType() | Represents the CrossType on the specified axis where the other axis crosses. |
GetCustomUnit() | Specifies a custom value for the display unit. |
GetDisplayUnit() | Represents the unit label for the specified axis. |
GetDisplayUnitLabel() | Represents a unit label on an axis in the specified chart. Unit labels are useful for charting large values— for example, in the millions or billions. |
GetHasMultiLevelLabels() | Indicates whether the labels shall be shown as multi level. |
GetLogBase() | Represents the logarithmic base. Default value is 10.Only applies for Excel2007. |
GetMajorGridLines() | Represents major gridlines on a chart axis. |
GetMajorTickMark() | Represents the type of major tick mark for the specified axis. |
GetMajorUnit() | Represents the major units for the axis. |
GetMajorUnitScale() | Represents the major unit scale for the category axis. |
GetMaxValue() | Represents the maximum value on the value axis. |
GetMinorGridLines() | Represents minor gridlines on a chart axis. |
GetMinorTickMark() | Represents the type of minor tick mark for the specified axis. |
GetMinorUnit() | Represents the minor units for the axis. |
GetMinorUnitScale() | Represents the major unit scale for the category axis. |
GetMinValue() | Represents the minimum value on the value axis. |
GetTickLabelPosition() | Represents the position of tick-mark labels on the specified axis. |
GetTickLabels() | Returns a TickLabels object that represents the tick-mark labels for the specified axis. |
GetTickLabelSpacing() | Represents the number of categories or series between tick-mark labels. Applies only to category and series axes. |
GetTickMarkSpacing() | Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. |
GetTitle() | Gets the axis’ title. |
IsAutomaticMajorUnit() | Indicates whether the major unit of the axis is automatically assigned. |
IsAutomaticMaxValue() | Indicates whether the max value is automatically assigned. |
IsAutomaticMinorUnit() | Indicates whether the minor unit of the axis is automatically assigned. |
IsAutomaticMinValue() | Indicates whether the min value is automatically assigned. |
IsAutoTickLabelSpacing() | Indicates whether the spacing of tick label is automatic. |
IsDisplayUnitLabelShown() | Represents if the display unit label is shown on the specified axis. |
IsLogarithmic() | Represents if the value axis scale type is logarithmic or not. |
IsNull() const | Checks whether the implementation object is nullptr. |
IsPlotOrderReversed() | Represents if Microsoft Excel plots data points from last to first. |
IsVisible() | Represents if the axis is visible. |
explicit operator bool() const | operator bool() |
operator=(const Axis& src) | operator= |
SetAxisBetweenCategories(bool value) | Represents if the value axis crosses the category axis between categories. |
SetBaseUnitScale(TimeUnit value) | Represents the base unit scale for the category axis. |
SetCategoryType(CategoryType value) | Represents the category axis type. |
SetCrossAt(double value) | Represents the point on the value axis where the category axis crosses it. |
SetCrossType(CrossType value) | Represents the CrossType on the specified axis where the other axis crosses. |
SetCustomUnit(int32_t value) | Specifies a custom value for the display unit. |
SetDisplayUnit(DisplayUnitType value) | Represents the unit label for the specified axis. |
SetHasMultiLevelLabels(bool value) | Indicates whether the labels shall be shown as multi level. |
SetIsAutomaticMajorUnit(bool value) | Indicates whether the major unit of the axis is automatically assigned. |
SetIsAutomaticMaxValue(bool value) | Indicates whether the max value is automatically assigned. |
SetIsAutomaticMinorUnit(bool value) | Indicates whether the minor unit of the axis is automatically assigned. |
SetIsAutomaticMinValue(bool value) | Indicates whether the min value is automatically assigned. |
SetIsAutoTickLabelSpacing(bool value) | Indicates whether the spacing of tick label is automatic. |
SetIsDisplayUnitLabelShown(bool value) | Represents if the display unit label is shown on the specified axis. |
SetIsLogarithmic(bool value) | Represents if the value axis scale type is logarithmic or not. |
SetIsPlotOrderReversed(bool value) | Represents if Microsoft Excel plots data points from last to first. |
SetIsVisible(bool value) | Represents if the axis is visible. |
SetLogBase(double value) | Represents the logarithmic base. Default value is 10.Only applies for Excel2007. |
SetMajorTickMark(TickMarkType value) | Represents the type of major tick mark for the specified axis. |
SetMajorUnit(double value) | Represents the major units for the axis. |
SetMajorUnitScale(TimeUnit value) | Represents the major unit scale for the category axis. |
SetMaxValue(const Aspose::Cells::Object& value) | Represents the maximum value on the value axis. |
SetMinorTickMark(TickMarkType value) | Represents the type of minor tick mark for the specified axis. |
SetMinorUnit(double value) | Represents the minor units for the axis. |
SetMinorUnitScale(TimeUnit value) | Represents the major unit scale for the category axis. |
SetMinValue(const Aspose::Cells::Object& value) | Represents the minimum value on the value axis. |
SetTickLabelPosition(TickLabelPositionType value) | Represents the position of tick-mark labels on the specified axis. |
SetTickLabelSpacing(int32_t value) | Represents the number of categories or series between tick-mark labels. Applies only to category and series axes. |
SetTickMarkSpacing(int32_t value) | Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. |
~Axis() | Destructor. |
Fields
Field | Description |
---|---|
_impl | The implementation object. |
Examples
Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.GetWorksheets().Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.GetWorksheets().Get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.GetCells().Get(u"A1").PutValue(50);
//Adding a sample value to "A2" cell
worksheet.GetCells().Get(u"A2").PutValue(100);
//Adding a sample value to "A3" cell
worksheet.GetCells().Get(u"A3").PutValue(150);
//Adding a sample value to "B1" cell
worksheet.GetCells().Get(u"B1").PutValue(4);
//Adding a sample value to "B2" cell
worksheet.GetCells().Get(u"B2").PutValue(20);
//Adding a sample value to "B3" cell
worksheet.GetCells().Get(u"B3").PutValue(50);
//Adding a chart to the worksheet
int chartIndex = worksheet.GetCharts().Add(ChartType::Column, 5, 0, 25, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.GetCharts().Get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.GetNSeries().Add(u"A1:B3", true);
//Set the major unit
chart.GetValueAxis().SetMajorUnit(25);
//Category(X) axis crosses at the maxinum value.
chart.GetValueAxis().SetCrossType(CrossType::Maximum);
//Set he number of categories or series between tick-mark labels.
chart.GetCategoryAxis().SetTickLabelSpacing(2);
//Saving the Excel file
workbook.Save(u"book1.xlsx");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells::Charts
- Library Aspose.Cells for C++