Area

Area class

Encapsulates the object that represents an area format.

class Area;

Example

const { Workbook, ChartType, Color } = require("aspose.cells.node");

//Instantiating a Workbook object
var workbook = new Workbook();
//Adding a new worksheet to the Workbook object
var sheetIndex = workbook.worksheets.add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.worksheets.get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.cells.get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.cells.get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.cells.get("A3").putValue(150);
//Adding a sample value to "B1" cell
worksheet.cells.get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.cells.get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.cells.get("B3").putValue(50);
//Adding a chart to the worksheet
var chartIndex = worksheet.charts.add(ChartType.Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
var chart = worksheet.charts.get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.nSeries.add("A1:B3", true);
//Setting the foreground color of the plot area
chart.plotArea.getArea().foregroundColor = Color.Blue;
//Setting the foreground color of the chart area
chart.chartArea.getArea().foregroundColor = Color.Yellow;
//Setting the foreground color of the 1st NSeries area
chart.nSeries.get(0).area.foregroundColor = Color.Red;
//Setting the foreground color of the area of the 1st NSeries point
chart.nSeries.get(0).points.get(0).area.foregroundColor = Color.Cyan;
//Saving the Excel file
workbook.save("output/DrawingArea.xls");

Properties

PropertyTypeDescription
backgroundColorColorGets or sets the background Color of the Area.
foregroundColorColorGets or sets the foreground Color.
formattingFormattingTypeRepresents the formatting of the area.
invertIfNegativebooleanIf the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.
fillFormatFillFormatReadonly. Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.
transparencynumberReturns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).

Methods

MethodDescription
getBackgroundColor()@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets the background Color of the Area.
setBackgroundColor(Color)@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets the background Color of the Area.
getForegroundColor()@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets the foreground Color.
setForegroundColor(Color)@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets the foreground Color.
getFormatting()@deprecated. Please use the ‘formatting’ property instead. Represents the formatting of the area.
setFormatting(FormattingType)@deprecated. Please use the ‘formatting’ property instead. Represents the formatting of the area.
getInvertIfNegative()@deprecated. Please use the ‘invertIfNegative’ property instead. If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.
setInvertIfNegative(boolean)@deprecated. Please use the ‘invertIfNegative’ property instead. If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.
getFillFormat()@deprecated. Please use the ‘fillFormat’ property instead. Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.
getTransparency()@deprecated. Please use the ’transparency’ property instead. Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
setTransparency(number)@deprecated. Please use the ’transparency’ property instead. Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
isNull()Checks whether the implementation object is null.

backgroundColor

Gets or sets the background Color of the Area.

backgroundColor : Color;

foregroundColor

Gets or sets the foreground Color.

foregroundColor : Color;

formatting

Represents the formatting of the area.

formatting : FormattingType;

invertIfNegative

If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.

invertIfNegative : boolean;

Example

const { Workbook, ChartType, Color } = require("aspose.cells.node");

//Instantiating a Workbook object
var workbook = new Workbook();
//Adding a new worksheet to the Workbook object
var sheetIndex = workbook.worksheets.add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.worksheets.get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.cells.get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.cells.get("A2").putValue(-100);
//Adding a sample value to "A3" cell
worksheet.cells.get("A3").putValue(150);
//Adding a chart to the worksheet
var chartIndex = worksheet.charts.add(ChartType.Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
var chart = worksheet.charts.get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "A3"
chart.nSeries.add("A1:A3", true);
chart.nSeries.get(0).area.invertIfNegative = true;
//Setting the foreground color of the 1st NSeries area
chart.nSeries.get(0).area.foregroundColor = Color.Red;
//Setting the background color of the 1st NSeries area.
//The displayed area color of second chart point will be the background color.
chart.nSeries.get(0).area.backgroundColor = Color.Yellow;
//Saving the Excel file
workbook.save("output/DrawingAreaInverseIfNegative.xls");

fillFormat

Readonly. Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.

fillFormat : FillFormat;

transparency

Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).

transparency : number;

getBackgroundColor()

@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets the background Color of the Area.

getBackgroundColor() : Color;

Returns

Color

setBackgroundColor(Color)

@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets the background Color of the Area.

setBackgroundColor(value: Color) : void;

Parameters:

ParameterTypeDescription
valueColorThe value to set.

getForegroundColor()

@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets the foreground Color.

getForegroundColor() : Color;

Returns

Color

setForegroundColor(Color)

@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets the foreground Color.

setForegroundColor(value: Color) : void;

Parameters:

ParameterTypeDescription
valueColorThe value to set.

getFormatting()

@deprecated. Please use the ‘formatting’ property instead. Represents the formatting of the area.

getFormatting() : FormattingType;

Returns

FormattingType

setFormatting(FormattingType)

@deprecated. Please use the ‘formatting’ property instead. Represents the formatting of the area.

setFormatting(value: FormattingType) : void;

Parameters:

ParameterTypeDescription
valueFormattingTypeThe value to set.

getInvertIfNegative()

@deprecated. Please use the ‘invertIfNegative’ property instead. If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.

getInvertIfNegative() : boolean;

setInvertIfNegative(boolean)

@deprecated. Please use the ‘invertIfNegative’ property instead. If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.

setInvertIfNegative(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getFillFormat()

@deprecated. Please use the ‘fillFormat’ property instead. Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.

getFillFormat() : FillFormat;

Returns

FillFormat

getTransparency()

@deprecated. Please use the ’transparency’ property instead. Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).

getTransparency() : number;

setTransparency(number)

@deprecated. Please use the ’transparency’ property instead. Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).

setTransparency(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;