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()
Deprecated.
Use ChartArea.HeightRatioToChart property, instead.
|
double |
getHeightRatioToChart()
Gets the vertical offset from its lower right corner row, in units of ratio of the chart area.
|
int |
getWidth()
Deprecated.
Use ChartArea.WidthRatioToChart property, instead.
|
double |
getWidthRatioToChart()
Gets the horizontal offset from its lower right corner column, in units of ratio of the chart area.
|
int |
getX()
Deprecated.
Use ChartArea.XRatioToChart property, instead.
|
double |
getXRatioToChart()
Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area.
|
int |
getY()
Deprecated.
Use ChartArea.YRatioToChart property, instead.
|
double |
getYRatioToChart()
Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area.
|
void |
setHeight(int value)
Deprecated.
Use ChartArea.HeightRatioToChart property, instead.
|
void |
setHeightRatioToChart(double value)
Sets the vertical offset from its lower right corner row, in units of ratio of the chart area.
|
void |
setWidth(int value)
Deprecated.
Use ChartArea.WidthRatioToChart property, instead.
|
void |
setWidthRatioToChart(double value)
Sets the horizontal offset from its lower right corner column, in units of ratio of the chart area.
|
void |
setX(int value)
Deprecated.
Use ChartArea.XRatioToChart property, instead.
|
void |
setXRatioToChart(double value)
Gets or gets the horizontal offset from its upper left corner column, in units of ratio of the chart area.
|
void |
setY(int value)
Deprecated.
Use ChartArea.YRatioToChart property, instead.
|
void |
setYRatioToChart(double value)
Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area.
|
getArea, getAutoScaleFont, getBackground, getBackgroundMode, getBorder, getChart, getDefaultHeight, getDefaultHeightRatioToChart, getDefaultWidth, getDefaultWidthRatioToChart, getDefaultX, getDefaultXRatioToChart, getDefaultY, getDefaultYRatioToChart, getHeightPixel, getShadow, getShapeProperties, getTextFont, getTextOptions, getWidthPixel, getXPixel, getYPixel, isAutomaticSize, isDefaultPosBeSet, isInnerMode, setAutomaticSize, setAutoScaleFont, setBackground, setBackgroundMode, setHeightPixel, setInnerMode, setPositionAuto, setShadow, setWidthPixel, setXPixel, setYPixelpublic int getX()
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.getX in class ChartFramepublic void setX(int value)
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 in class ChartFramepublic int getY()
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.getY in class ChartFramepublic void setY(int value)
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 in class ChartFramepublic int getHeight()
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.getHeight in class ChartFramepublic void setHeight(int value)
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 in class ChartFramepublic int getWidth()
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.getWidth in class ChartFramepublic void setWidth(int value)
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 in class ChartFramepublic double getXRatioToChart()
getXRatioToChart in class ChartFramepublic void setXRatioToChart(double value)
setXRatioToChart in class ChartFramepublic double getYRatioToChart()
getYRatioToChart in class ChartFramepublic void setYRatioToChart(double value)
setYRatioToChart in class ChartFramepublic double getHeightRatioToChart()
getHeightRatioToChart in class ChartFramepublic void setHeightRatioToChart(double value)
setHeightRatioToChart in class ChartFramepublic double getWidthRatioToChart()
getWidthRatioToChart in class ChartFramepublic void setWidthRatioToChart(double value)
setWidthRatioToChart 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 2003-2025. All Rights Reserved.