Aspose::Cells::Charts::ChartArea class

ChartArea class

Encapsulates the object that represents the chart area in the worksheet.

class ChartArea : public Aspose::Cells::Charts::ChartFrame

Methods

MethodDescription
ChartArea(ChartArea_Impl* impl)Constructs from an implementation object.
ChartArea(const ChartArea& src)Copy constructor.
ChartArea(const ChartFrame& src)Constructs from a parent object.
ChartFrame(ChartFrame_Impl* impl)Constructs from an implementation object.
ChartFrame(const ChartFrame& src)Copy constructor.
GetArea()Gets the area.
GetAutoScaleFont()True if the text in the object changes font size when the object size changes. The default value is True.
GetBackgroundMode()Gets and sets the display mode of the background.
GetBorder()Gets the border.
GetDefaultHeight()(Deprecated) Represents height of default position in units of 1/4000 of the chart area.
GetDefaultHeightRatioToChart()Represents height of default position in units of Fraction of the chart area.
GetDefaultWidth()(Deprecated) Represents width of default position in units of 1/4000 of the chart area.
GetDefaultWidthRatioToChart()Represents width of default position in units of Fraction of the chart area.
GetDefaultX()(Deprecated) Represents x of default position in units of 1/4000 of the chart area.
GetDefaultXRatioToChart()Represents x of default position in units of Fraction of the chart area.
GetDefaultY()(Deprecated) Represents y of default position in units of 1/4000 of the chart area.
GetDefaultYRatioToChart()Represents y of default position in units of Fraction of the chart area.
GetFont()Gets a Font object of the specified chartarea object.
GetHeight()(Deprecated) Gets or sets the vertical offset from its lower right corner row, in units of 1/4000 of the chart area.
GetHeightPixel()Gets or sets the height of frame in units of Pixel.
GetHeightRatioToChart()Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area.
GetShadow()True if the frame has a shadow.
GetShapeProperties()Gets the ShapeProperties object.
GetTextOptions()Gets and sets the options of the text.
GetWidth()(Deprecated) Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area.
GetWidthPixel()Gets or sets the width of frame in units of Pixel.
GetWidthRatioToChart()Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area.
GetX()(Deprecated) Gets or gets the horizontal offset from its upper left corner column, in units of 1/4000 of the chart area.
GetXPixel()Gets or sets the x coordinate of the upper left corner in units of Pixel.
GetXRatioToChart()Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area.
GetY()(Deprecated) Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area.
GetYPixel()Gets or sets the y coordinate of the upper left corner in units of Pixel.
GetYRatioToChart()Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area.
IsAutomaticSize()Indicates whether the chart frame is automatic sized.
IsDefaultPosBeSet()Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.
IsInnerMode()Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const ChartArea& src)operator=
operator=(const ChartFrame& src)operator=
SetAutoScaleFont(bool value)True if the text in the object changes font size when the object size changes. The default value is True.
SetBackgroundMode(BackgroundMode value)Gets and sets the display mode of the background.
SetHeight(int32_t value)(Deprecated) Gets or sets the vertical offset from its lower right corner row, in units of 1/4000 of the chart area.
SetHeightPixel(int32_t value)Gets or sets the height of frame in units of Pixel.
SetHeightRatioToChart(double value)Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area.
SetIsAutomaticSize(bool value)Indicates whether the chart frame is automatic sized.
SetIsInnerMode(bool value)Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.
SetPositionAuto()Set position of the frame to automatic.
SetShadow(bool value)True if the frame has a shadow.
SetWidth(int32_t value)(Deprecated) Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area.
SetWidthPixel(int32_t value)Gets or sets the width of frame in units of Pixel.
SetWidthRatioToChart(double value)Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area.
SetX(int32_t value)(Deprecated) Gets or gets the horizontal offset from its upper left corner column, in units of 1/4000 of the chart area.
SetXPixel(int32_t value)Gets or sets the x coordinate of the upper left corner in units of Pixel.
SetXRatioToChart(double value)Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area.
SetY(int32_t value)(Deprecated) Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area.
SetYPixel(int32_t value)Gets or sets the y coordinate of the upper left corner in units of Pixel.
SetYRatioToChart(double value)Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area.
~ChartArea()Destructor.
~ChartFrame()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;

//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.GetWorksheets().Get(0);

//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(60);

//Adding a sample value to "B2" cell
worksheet.GetCells().Get(u"B2").PutValue(32);

//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, 15, 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);

//Getting Chart Area
ChartArea chartArea = chart.GetChartArea();

//Setting the foreground color of the chart area
chartArea.GetArea().SetForegroundColor(Color{ 0xff, 0xff, 0xff, 0 });

//Setting Chart Area Shadow
chartArea.SetShadow(true);

//Saving the Excel file
workbook.Save(u"book1.xls");

Aspose::Cells::Cleanup();

See Also