ChartArea class
ChartArea class
Encapsulates the object that represents the chart area in the worksheet.
Inheritance: ChartArea
→
ChartFrame
The ChartArea type exposes the following members:
Properties
Property | Description |
---|---|
is_inner_mode | Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels. |
border | Gets the Line . |
area | Gets the ChartFrame.area . |
text_font | Gets a ChartFrame.font object of the specified ChartFrame object. |
text_options | Gets and sets the options of the text. |
font | Gets a ChartArea.font object of the specified chartarea object. |
auto_scale_font | True if the text in the object changes font size when the object size changes. The default value is True. |
background_mode | Gets and sets the display mode of the background |
background | Gets and sets the display mode of the background |
is_automatic_size | Indicates whether the chart frame is automatic sized. |
x | Gets or gets the horizontal offset from its upper left corner column. |
y | Gets or gets the vertical offset from its upper left corner row. |
height | Gets or sets the vertical offset from its lower right corner row. |
width | Gets or sets the horizontal offset from its lower right corner column. |
shadow | True if the frame has a shadow. |
shape_properties | Gets the ChartFrame.shape_properties object. |
is_default_pos_be_set | Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set. |
default_x | Represents x of default position |
default_y | Represents y of default position |
default_width | Represents width of default position |
default_height | Represents height of default position |
Methods
Method | Description |
---|---|
set_position_auto | Set position of the frame to automatic |
Example
from aspose.cells import Workbook
from aspose.cells.charts import ChartType
from aspose.pydrawing import Color
# Instantiating a Workbook object
workbook = Workbook()
# Obtaining the reference of the first worksheet
worksheet = workbook.worksheets[0]
# Adding a sample value to "A1" cell
worksheet.cells.get("A1").put_value(50)
# Adding a sample value to "A2" cell
worksheet.cells.get("A2").put_value(100)
# Adding a sample value to "A3" cell
worksheet.cells.get("A3").put_value(150)
# Adding a sample value to "B1" cell
worksheet.cells.get("B1").put_value(60)
# Adding a sample value to "B2" cell
worksheet.cells.get("B2").put_value(32)
# Adding a sample value to "B3" cell
worksheet.cells.get("B3").put_value(50)
# Adding a chart to the worksheet
chartIndex = worksheet.charts.add(ChartType.COLUMN, 5, 0, 15, 5)
# Accessing the instance of the newly added chart
chart = worksheet.charts[chartIndex]
# Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.n_series.add("A1:B3", True)
# Getting Chart Area
chartArea = chart.chart_area
# Setting the foreground color of the chart area
chartArea.area.foreground_color = Color.yellow
# Setting Chart Area Shadow
chartArea.shadow = True
# Saving the Excel file
workbook.save("book1.xls")
See Also
- module
aspose.cells.charts
- class
ChartArea
- class
ChartFrame
- class
Line