class Charts(impl)

A collection of all chart objects 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=0, top=0, width=355, height=211)

Creates a new chart on the specified sheet.


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




>>> 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'
property api

Returns the native object (pywin32 or appscript obj) of the engine being used.

property count

Returns the number of objects in the collection.