ChartArea
ChartArea class
Encapsulates the object that represents the chart area in the worksheet.
class ChartArea extends ChartFrame;
Example
const { Workbook, ChartType, Color } = require("aspose.cells.node");
//Instantiating a Workbook object
var workbook = new Workbook();
//Obtaining the reference of the first worksheet
var worksheet = workbook.getWorksheets().get(0);
//Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150);
//Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50);
//Adding a chart to the worksheet
var chartIndex = worksheet.getCharts().add(ChartType.Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
var chart = worksheet.getCharts().get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.getNSeries().add("A1:B3", true);
//Getting Chart Area
var chartArea = chart.getChartArea();
//Setting the foreground color of the chart area
chartArea.getArea().setForegroundColor(Color.Yellow);
//Setting Chart Area Shadow
chartArea.setShadow(true);
//Saving the Excel file
workbook.save("output/ChartsChartArea.xls");
Constructors
Name | Description |
---|---|
constructor(ChartFrame) | Constructs from a parent object convertible to this. |
Methods
Method | Description |
---|---|
getX() | Gets or gets the horizontal offset from its upper left corner column, in units of 1/4000 of the chart area. |
setX(number) | Gets or gets the horizontal offset from its upper left corner column, in units of 1/4000 of the chart area. |
getY() | Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area. |
setY(number) | Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area. |
getHeight() | Gets or sets the vertical offset from its lower right corner row, in units of 1/4000 of the chart area. |
setHeight(number) | Gets or sets the vertical offset from its lower right corner row, in units of 1/4000 of the chart area. |
getWidth() | Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area. |
setWidth(number) | Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area. |
getXRatioToChart() | Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area. |
setXRatioToChart(number) | Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area. |
getYRatioToChart() | Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area. |
setYRatioToChart(number) | Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area. |
getHeightRatioToChart() | Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area. |
setHeightRatioToChart(number) | Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area. |
getWidthRatioToChart() | Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area. |
setWidthRatioToChart(number) | Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area. |
getFont() | Gets a Font object of the specified chartarea object. |
isNull() | Checks whether the implementation object is null. |
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. |
setIsInnerMode(boolean) | 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. |
getBackgroundMode() | Gets and sets the display mode of the background |
setBackgroundMode(BackgroundMode) | Gets and sets the display mode of the background |
getShadow() | True if the frame has a shadow. |
setShadow(boolean) | True if the frame has a shadow. |
getShapeProperties() | Gets the ShapeProperties object. |
isDefaultPosBeSet() | Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set. |
getDefaultX() | Represents x of default position in units of 1/4000 of the chart area. |
getDefaultY() | Represents y of default position in units of 1/4000 of the chart area. |
getDefaultWidth() | Represents width of default position in units of 1/4000 of the chart area. |
getDefaultHeight() | Represents height 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. |
getDefaultYRatioToChart() | Represents y of default position in units of Fraction of the chart area. |
getDefaultWidthRatioToChart() | Represents width of default position in units of Fraction of the chart area. |
getDefaultHeightRatioToChart() | Represents height of default position in units of Fraction of the chart area. |
setPositionAuto() | Set position of the frame to automatic |
getBorder() | Gets the |
getArea() | Gets the |
getTextOptions() | Gets and sets the options of the text. |
getAutoScaleFont() | True if the text in the object changes font size when the object size changes. The default value is True. |
setAutoScaleFont(boolean) | True if the text in the object changes font size when the object size changes. The default value is True. |
isAutomaticSize() | Indicates whether the chart frame is automatic sized. |
setIsAutomaticSize(boolean) | Indicates whether the chart frame is automatic sized. |
getXPixel() | Gets or sets the x coordinate of the upper left corner in units of Pixel. |
setXPixel(number) | Gets or sets the x coordinate of the upper left corner in units of Pixel. |
getYPixel() | Gets or sets the y coordinate of the upper left corner in units of Pixel. |
setYPixel(number) | Gets or sets the y coordinate of the upper left corner in units of Pixel. |
getWidthPixel() | Gets or sets the width of frame in units of Pixel. |
setWidthPixel(number) | Gets or sets the width of frame in units of Pixel. |
getHeightPixel() | Gets or sets the height of frame in units of Pixel. |
setHeightPixel(number) | Gets or sets the height of frame in units of Pixel. |
constructor(ChartFrame)
Constructs from a parent object convertible to this.
constructor(obj: ChartFrame);
Parameters:
Parameter | Type | Description |
---|---|---|
obj | ChartFrame | The parent object. |
getX()
Gets or gets the horizontal offset from its upper left corner column, in units of 1/4000 of the chart area.
getX() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartArea.XRatioToChart property, instead. X = XRatioToChart * 4000. This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
setX(number)
Gets or gets the horizontal offset from its upper left corner column, in units of 1/4000 of the chart area.
setX(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
Remarks
NOTE: This member is now obsolete. Please use ChartArea.XRatioToChart property, instead. X = XRatioToChart * 4000. This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getY()
Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area.
getY() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartArea.YRatioToChart property, instead. Y = YRatioToChart * 4000; This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
setY(number)
Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area.
setY(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
Remarks
NOTE: This member is now obsolete. Please use ChartArea.YRatioToChart property, instead. Y = YRatioToChart * 4000; This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getHeight()
Gets or sets the vertical offset from its lower right corner row, in units of 1/4000 of the chart area.
getHeight() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartArea.HeightRatioToChart property, instead. Height = HeightRatioToChart * 4000. This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
setHeight(number)
Gets or sets the vertical offset from its lower right corner row, in units of 1/4000 of the chart area.
setHeight(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
Remarks
NOTE: This member is now obsolete. Please use ChartArea.HeightRatioToChart property, instead. Height = HeightRatioToChart * 4000. This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getWidth()
Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area.
getWidth() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartArea.WidthRatioToChart property, instead. Width = WidthRatioToChart * 4000. This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
setWidth(number)
Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area.
setWidth(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
Remarks
NOTE: This member is now obsolete. Please use ChartArea.WidthRatioToChart property, instead. Width = WidthRatioToChart * 4000. This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getXRatioToChart()
Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area.
getXRatioToChart() : number;
setXRatioToChart(number)
Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area.
setXRatioToChart(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getYRatioToChart()
Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area.
getYRatioToChart() : number;
setYRatioToChart(number)
Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area.
setYRatioToChart(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getHeightRatioToChart()
Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area.
getHeightRatioToChart() : number;
setHeightRatioToChart(number)
Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area.
setHeightRatioToChart(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getWidthRatioToChart()
Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area.
getWidthRatioToChart() : number;
setWidthRatioToChart(number)
Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area.
setWidthRatioToChart(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getFont()
Gets a Font object of the specified chartarea object.
getFont() : Font;
Returns
isNull()
Checks whether the implementation object is null.
isNull() : boolean;
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.
isInnerMode() : boolean;
Remarks
Only for Xlsx file.
setIsInnerMode(boolean)
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.
setIsInnerMode(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
Remarks
Only for Xlsx file.
getBackgroundMode()
Gets and sets the display mode of the background
getBackgroundMode() : BackgroundMode;
Returns
setBackgroundMode(BackgroundMode)
Gets and sets the display mode of the background
setBackgroundMode(value: BackgroundMode) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | BackgroundMode | The value to set. |
getShadow()
True if the frame has a shadow.
getShadow() : boolean;
setShadow(boolean)
True if the frame has a shadow.
setShadow(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getShapeProperties()
Gets the ShapeProperties object.
getShapeProperties() : ShapePropertyCollection;
Returns
isDefaultPosBeSet()
Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.
isDefaultPosBeSet() : boolean;
getDefaultX()
Represents x of default position in units of 1/4000 of the chart area.
getDefaultX() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartFrame.DefaultXRatioToChart property, instead. DefaultX = (int)(DefaultXRatioToChart * 4000); This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getDefaultY()
Represents y of default position in units of 1/4000 of the chart area.
getDefaultY() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartFrame.DefaultYRatioToChart property, instead. DefaultY = (int)(DefaultYRatioToChart * 4000); This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getDefaultWidth()
Represents width of default position in units of 1/4000 of the chart area.
getDefaultWidth() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartFrame.DefaultWidthRatioToChart property, instead. DefaultWidth = (int)(DefaultWidthRatioToChart * 4000); This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getDefaultHeight()
Represents height of default position in units of 1/4000 of the chart area.
getDefaultHeight() : number;
Remarks
NOTE: This member is now obsolete. Please use ChartFrame.DefaultHeightRatioToChart property, instead. DefaultHeight = (int)(DefaultHeightRatioToChart * 4000); This property will be removed 12 months later since February 2025. Aspose apologizes for any inconvenience you may have experienced.
getDefaultXRatioToChart()
Represents x of default position in units of Fraction of the chart area.
getDefaultXRatioToChart() : number;
getDefaultYRatioToChart()
Represents y of default position in units of Fraction of the chart area.
getDefaultYRatioToChart() : number;
getDefaultWidthRatioToChart()
Represents width of default position in units of Fraction of the chart area.
getDefaultWidthRatioToChart() : number;
getDefaultHeightRatioToChart()
Represents height of default position in units of Fraction of the chart area.
getDefaultHeightRatioToChart() : number;
setPositionAuto()
Set position of the frame to automatic
setPositionAuto() : void;
getBorder()
Gets the
getBorder() : Line;
Returns
getArea()
Gets the
getArea() : Area;
Returns
getTextOptions()
Gets and sets the options of the text.
getTextOptions() : TextOptions;
Returns
getAutoScaleFont()
True if the text in the object changes font size when the object size changes. The default value is True.
getAutoScaleFont() : boolean;
setAutoScaleFont(boolean)
True if the text in the object changes font size when the object size changes. The default value is True.
setAutoScaleFont(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
isAutomaticSize()
Indicates whether the chart frame is automatic sized.
isAutomaticSize() : boolean;
setIsAutomaticSize(boolean)
Indicates whether the chart frame is automatic sized.
setIsAutomaticSize(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getXPixel()
Gets or sets the x coordinate of the upper left corner in units of Pixel.
getXPixel() : number;
setXPixel(number)
Gets or sets the x coordinate of the upper left corner in units of Pixel.
setXPixel(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getYPixel()
Gets or sets the y coordinate of the upper left corner in units of Pixel.
getYPixel() : number;
setYPixel(number)
Gets or sets the y coordinate of the upper left corner in units of Pixel.
setYPixel(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getWidthPixel()
Gets or sets the width of frame in units of Pixel.
getWidthPixel() : number;
setWidthPixel(number)
Gets or sets the width of frame in units of Pixel.
setWidthPixel(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getHeightPixel()
Gets or sets the height of frame in units of Pixel.
getHeightPixel() : number;
setHeightPixel(number)
Gets or sets the height of frame in units of Pixel.
setHeightPixel(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |