ChartPointCollection
Contents
[
Hide
]ChartPointCollection class
Represents a collection that contains all the points in one series.
class ChartPointCollection;
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.PieExploded, 5, 0, 25, 10);
//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);
//Show Data Labels
chart.getNSeries().get(0).getDataLabels().setShowValue(true);
var points = chart.getNSeries().get(0).getPoints();
var red = Color.Red;
for (var i = 0; i < points.getCount(); i++)
{
//Get Data Point
var point = points.get(i);
//Set Pir Explosion
point.setExplosion(15);
//Set Border Color
point.getBorder().setColor(red);
}
//Saving the Excel file
workbook.save("output/ChartsChartPointCollection.xls");
Methods
Method | Description |
---|---|
get(number) | Gets the ChartPoint element at the specified index in the series. |
getCount() | Gets the count of the chart point. |
getEnumerator() | Returns an enumerator for the entire ChartPointCollection. |
clear() | Remove all setting of the chart points. |
removeAt(number) | Removes point at the index of the series.. |
isNull() | Checks whether the implementation object is null. |
get(number)
Gets the ChartPoint element at the specified index in the series.
get(index: number) : ChartPoint;
Parameters:
Parameter | Type | Description |
---|---|---|
index | number | The index of chart point in the series. |
Returns
The ChartPoint object.
getCount()
Gets the count of the chart point.
getCount() : number;
getEnumerator()
Returns an enumerator for the entire ChartPointCollection.
getEnumerator() : ChartPointEnumerator;
Returns
clear()
Remove all setting of the chart points.
clear() : void;
removeAt(number)
Removes point at the index of the series..
removeAt(index: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
index | number | The index of the point. |
isNull()
Checks whether the implementation object is null.
isNull() : boolean;