Chart(worksheet, domain=None, ranges=None, chart_type=None, title='', anchor_cell=None, json_obj=None)¶
Represents a chart in a sheet.
- worksheet – Worksheet object in which the chart resides
- domain – Cell range of the desired chart domain in the form of tuple of tuples
- ranges – Cell ranges of the desired ranges in the form of list of tuple of tuples
- chart_type – An instance of
- title – Title of the chart
- anchor_cell – Position of the left corner of the chart in the form of cell address or cell object
- json_obj – Represents a json structure of the chart as given in api.
Title of the chart
Domain of the chart. The domain takes the cell range in the form of tuple of cell adresses. Where first adress is the top cell of the column and 2nd element the last adress of the column.
Example: ((1,1),(6,1)) or (‘A1’,’A6’)
Type of the chart The specificed as enum of type :class:’ChartType’
The available chart types are given in the api docs .
Ranges of the chart (y values) A chart can have multiple columns as range. So you can provide them as a list. The ranges are taken in the form of list of tuple of cell adresses. where each tuple inside the list represents a column as staring and ending cell.
- [((1,2),(6,2)), ((1,3),(6,3))] or [(‘B1’,’B6’), (‘C1’,’C6’)]
Font family of the title. (Default: ‘Roboto’)
Font name for the chart. (Default: ‘Roboto’)
Legend postion of the chart. (Default: ‘RIGHT_LEGEND’) The available options are given in the api docs.
Id of the this chart.
Position of the left corner of the chart in the form of cell address or cell object, Changing this will move the chart.
Deletes the chart.
Once the chart is deleted the objects of that chart still exist and should not be used.
Refreshes the object to incorporate the changes made in the chart through other objects or Google sheet
updates the applied changes to the sheet.
Returns the chart as a dictionary structured like the Google Sheets API v4.
Reads a json-dictionary returned by the Google Sheets API v4 and initialize all the properties from it.
Parameters: chart_data – The chart data as json specified in sheets api.