public class ChartArea extends ChartFrame
Example
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first worksheet
Worksheet 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
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("A1:B3", true);
//Getting Chart Area
ChartArea chartArea = chart.getChartArea();
//Setting the foreground color of the chart area
chartArea.getArea().setForegroundColor(Color.getYellow());
//Setting Chart Area Shadow
chartArea.setShadow(true);
//Saving the Excel file
workbook.save("book1.xls");
| Modifier and Type | Method and Description |
|---|---|
Font |
getFont()
Gets a
getFont() object of the specified chartarea object. |
int |
getHeight()
Gets the vertical offset from its lower right corner row.
|
int |
getWidth()
Gets the horizontal offset from its lower right corner column.
|
int |
getX()
Gets or gets the horizontal offset from its upper left corner column.
|
int |
getY()
Gets or gets the vertical offset from its upper left corner row.
|
void |
setHeight(int value)
Sets the vertical offset from its lower right corner row.
|
void |
setWidth(int value)
Sets the horizontal offset from its lower right corner column.
|
void |
setX(int value)
Gets or gets the horizontal offset from its upper left corner column.
|
void |
setY(int value)
Gets or gets the vertical offset from its upper left corner row.
|
getArea, getAutoScaleFont, getBackground, getBackgroundMode, getBorder, getChart, getDefaultHeight, getDefaultWidth, getDefaultX, getDefaultY, getShadow, getShapeProperties, getTextFont, getTextOptions, isAutomaticSize, isDefaultPosBeSet, isInnerMode, setAutomaticSize, setAutoScaleFont, setBackground, setBackgroundMode, setInnerMode, setPositionAuto, setShadowpublic int getX()
getX in class ChartFramepublic void setX(int value)
setX in class ChartFramepublic int getY()
getY in class ChartFramepublic void setY(int value)
setY in class ChartFramepublic int getHeight()
getHeight in class ChartFramepublic void setHeight(int value)
setHeight in class ChartFramepublic int getWidth()
getWidth in class ChartFramepublic void setWidth(int value)
setWidth in class ChartFramepublic Font getFont()
getFont() object of the specified chartarea object.getFont in class ChartFrameSee Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2001-2023. All Rights Reserved.