@univerjs-pro/sheets-sparkline v0.5.4


Class: FSparkline

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

Constructors

new FSparkline()

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

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

Parameters

ParameterType
_unitIdstring
_subUnitIdstring
_groupIdstring
_rownumber
_colnumber
_injectorInjector

Returns

FSparkline

Properties

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

Methods

changeDataSource()

changeDataSource(sourceRange, targetRange): undefined | FSparkline

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

Parameters

ParameterTypeDescription
sourceRangeIRangeLocation of new data source
targetRangeIRangeNew placement

Returns

undefined | FSparkline

Return this, for chaining

Description

Modify the data source of the sparkline in the current cell

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
 
// add sparkline
const sparkline = worksheet.addSparkline(
  [{ startRow: 0, endRow: 6, startColumn: 0, endColumn: 0 }],
  [{ startRow: 9, endRow: 9, startColumn: 0, endColumn: 0 }]
);
 
// update sparkline data source
sparkline.changeDataSource(
  { startRow: 0, endRow: 6, startColumn: 1, endColumn: 1 },
  { startRow: 9, endRow: 9, startColumn: 0, endColumn: 0 }
);

removeSparkline()

removeSparkline(): void

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

Returns

void

Description

Delete the sparkline in the current cell

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
 
const sparkline = worksheet.addSparkline(
  [{ startRow: 0, endRow: 6, startColumn: 0, endColumn: 0 }],
  [{ startRow: 9, endRow: 9, startColumn: 0, endColumn: 0 }]
);
 
sparkline.removeSparkline();