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.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.getWorksheets().get(sheetIndex);
//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);
//Setting the foreground color of the plot area
chart.getPlotArea().getArea().setForegroundColor(Color.Blue);
//Setting the foreground color of the chart area
chart.getChartArea().getArea().setForegroundColor(Color.Yellow);
//Setting the foreground color of the 1st NSeries area
chart.getNSeries().get(0).getArea().setForegroundColor(Color.Red);
//Setting the foreground color of the area of the 1st NSeries point
chart.getNSeries().get(0).getPoints().get(0).getArea().setForegroundColor(Color.Cyan);
//Saving the Excel file
workbook.save("output/DrawingArea.xls");
Methods
Method | Description |
---|---|
getBackgroundColor() | Gets or sets the background Color of the Area. |
setBackgroundColor(Color) | Gets or sets the background Color of the Area. |
getForegroundColor() | Gets or sets the foreground Color. |
setForegroundColor(Color) | Gets or sets the foreground Color. |
getFormatting() | Represents the formatting of the area. |
setFormatting(FormattingType) | Represents the formatting of the area. |
getInvertIfNegative() | 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) | 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() | Represents a FillFormat object that contains fill formatting properties for the specified chart or shape. |
getTransparency() | Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear). |
setTransparency(number) | 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. |
getBackgroundColor()
Gets or sets the background Color of the Area.
getBackgroundColor() : Color;
Returns
setBackgroundColor(Color)
Gets or sets the background Color of the Area.
setBackgroundColor(value: Color) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color | The value to set. |
getForegroundColor()
Gets or sets the foreground Color.
getForegroundColor() : Color;
Returns
setForegroundColor(Color)
Gets or sets the foreground Color.
setForegroundColor(value: Color) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color | The value to set. |
getFormatting()
Represents the formatting of the area.
getFormatting() : FormattingType;
Returns
setFormatting(FormattingType)
Represents the formatting of the area.
setFormatting(value: FormattingType) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | FormattingType | The value to set. |
getInvertIfNegative()
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)
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:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
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.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.getWorksheets().get(sheetIndex);
//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 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 "A3"
chart.getNSeries().add("A1:A3", true);
chart.getNSeries().get(0).getArea().setInvertIfNegative(true);
//Setting the foreground color of the 1st NSeries area
chart.getNSeries().get(0).getArea().setForegroundColor(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.getNSeries().get(0).getArea().setBackgroundColor(Color.Yellow);
//Saving the Excel file
workbook.save("output/DrawingAreaInverseIfNegative.xls");
getFillFormat()
Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.
getFillFormat() : FillFormat;
Returns
getTransparency()
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)
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:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
isNull()
Checks whether the implementation object is null.
isNull() : boolean;