Skip to content

Latest commit

 

History

History
221 lines (129 loc) · 4.43 KB

AbstractChart.md

File metadata and controls

221 lines (129 loc) · 4.43 KB

o-spreadsheet API / AbstractChart

Class: AbstractChart

AbstractChart is the class from which every Chart should inherit. The role of this class is to maintain the state of each chart.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new AbstractChart(definition, sheetId, getters)

Parameters

Name Type
definition ChartDefinition
sheetId UID
getters CoreGetters

Properties

getters

Protected Readonly getters: CoreGetters


sheetId

Readonly sheetId: UID


title

Readonly title: string


type

Readonly Abstract type: ChartType

Methods

copyForSheetId

Abstract copyForSheetId(sheetId): AbstractChart

Get a copy a the chart adapted to the given sheetId. The ranges that are in the same sheet as the chart will be adapted to the given sheetId.

Parameters

Name Type
sheetId UID

Returns

AbstractChart


copyInSheetId

Abstract copyInSheetId(sheetId): AbstractChart

Get a copy a the chart in the given sheetId. The ranges of the chart will stay the same as the copied chart.

Parameters

Name Type
sheetId UID

Returns

AbstractChart


getContextCreation

Abstract getContextCreation(): ChartCreationContext

Extract the ChartCreationContext of the chart

Returns

ChartCreationContext


getDefinition

Abstract getDefinition(): ChartDefinition

Get the definition of the chart

Returns

ChartDefinition


getDefinitionForExcel

Abstract getDefinitionForExcel(): undefined | ExcelChartDefinition

Get the definition of the chart that will be used for excel export. If the chart is not supported by Excel, this function returns undefined.

Returns

undefined | ExcelChartDefinition


updateRanges

Abstract updateRanges(applyChange): AbstractChart

This function should be used to update all the ranges of the chart after a grid change (add/remove col/row, rename sheet, ...)

Parameters

Name Type
applyChange ApplyRangeChange

Returns

AbstractChart


getDefinitionFromContextCreation

Static getDefinitionFromContextCreation(context): ChartDefinition

Get an empty definition based on the given context

Parameters

Name Type
context ChartCreationContext

Returns

ChartDefinition


transformDefinition

Static transformDefinition(definition, executed): ChartDefinition

Get a new chart definition transformed with the executed command. This functions will be called during operational transform process

Parameters

Name Type
definition ChartDefinition
executed AddColumnsRowsCommand | RemoveColumnsRowsCommand

Returns

ChartDefinition


validateChartDefinition

Static validateChartDefinition(validator, definition): CommandResult | CommandResult[]

Validate the chart definition given as arguments. This function will be called from allowDispatch function

Parameters

Name Type
validator Validator
definition ChartDefinition

Returns

CommandResult | CommandResult[]