Class: FSparkline
The facade class for the sparkline.
Methods
changeDataSource()
changeDataSource(sourceRange, targetRange): FSparkline
Parameters
Parameter | Type | Description |
---|---|---|
sourceRange | IRange | Location of new data source |
targetRange | IRange | New placement |
Returns
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
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();