@univerjs-pro/sheets-sparkline v0.5.4


Class: FSparklineGroup

Defined in: packages/sheets-sparkline/src/facade/f-sparkline-group.ts:6

Constructors

new FSparklineGroup()

new FSparklineGroup(
   _unitId, 
   _subUnitId, 
   _groupId, 
   _row, 
   _col, 
   _injector): FSparklineGroup

Defined in: packages/sheets-sparkline/src/facade/f-sparkline-group.ts:7

Parameters

ParameterType
_unitIdstring
_subUnitIdstring
_groupIdstring
_rownumber
_colnumber
_injectorInjector

Returns

FSparklineGroup

Properties

PropertyModifierTypeDefined in
_injectorreadonlyInjectorpackages/sheets-sparkline/src/facade/f-sparkline-group.ts:13

Methods

changeDataSource()

changeDataSource(sourceRanges, targetRanges): undefined | FSparklineGroup

Defined in: packages/sheets-sparkline/src/facade/f-sparkline-group.ts:34

Parameters

ParameterTypeDescription
sourceRangesIRange[]Location of new data source
targetRangesIRange[]New placement

Returns

undefined | FSparklineGroup

Return this, for chaining

Description

Modify the data source of the sparkline group

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
 
// get sparkline by cell
const sparklineGroup = worksheet.getSparklineGroupByCell(9, 0);
sparklineGroup.changeDataSource(
  [{ startRow: 0, endRow: 6, startColumn: 1, endColumn: 1 }],
  [{ startRow: 9, endRow: 9, startColumn: 0, endColumn: 0 }]
);

removeSparklineGroup()

removeSparklineGroup(): void

Defined in: packages/sheets-sparkline/src/facade/f-sparkline-group.ts:80

Returns

void

Description

Delete the sparkline group

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
 
// get sparkline by cell
const sparklineGroup = worksheet.getSparklineGroupByCell(9, 0);
 
// remove sparkline group
sparklineGroup.removeSparkline();

setConfig()

setConfig(config): FSparklineGroup

Defined in: packages/sheets-sparkline/src/facade/f-sparkline-group.ts:103

Parameters

ParameterTypeDescription
configISparklineGroupConfignew sparkline group config

Returns

FSparklineGroup

Return this, for chaining

Description

Modify the configuration of the current sparkline group

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
 
const sparkline = worksheet.getSparklineGroupByCell(9, 0);
// set sparkline type to bar chart
sparkline.setConfig({ type: SparklineTypeEnum.BAR_CHART });