Charts¶
- class Charts(impl: Any)¶
A collection of all
chartobjects on the specified sheet:>>> import xlwings as xw >>> xw.books['Book1'].sheets[0].charts Charts([<Chart 'Chart 1' in <Sheet [Book1]Sheet1>>, <Chart 'Chart 1' in <Sheet [Book1]Sheet1>>])
Added in version 0.9.0.
- add(left: float = 0, top: float = 0, width: float = 355, height: float = 211) Chart¶
Creates a new chart on the specified sheet.
Arguments¶
- leftfloat, default 0
left position in points
- topfloat, default 0
top position in points
- widthfloat, default 355
width in points
- heightfloat, default 211
height in points
Returns¶
Chart
Examples¶
>>> import xlwings as xw >>> sht = xw.Book().sheets[0] >>> sht.range('A1').value = [['Foo1', 'Foo2'], [1, 2]] >>> chart = sht.charts.add() >>> chart.set_source_data(sht.range('A1').expand()) >>> chart.chart_type = 'line' >>> chart.name 'Chart1'
- property api: Any¶
Returns the native object (
pywin32orappscriptobj) of the engine being used.
- property count: int¶
Returns the number of objects in the collection.