类: FSparkline
The facade class for the sparkline.
方法
changeDataSource()
changeDataSource(sourceRange, targetRange): FSparkline;参数
| 参数 | 类型 | 描述 | 
|---|---|---|
sourceRange | IRange | Location of new data source | 
targetRange | IRange | New placement | 
返回
FSparkline
Return this, for chaining
Description
Modify the data source of the sparkline in the current cell
示例
const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
 
// Create a sparkline in the range A10, with the data source in the range A1:A7.
const sparkline = fWorksheet.addSparkline(
  [fWorksheet.getRange('A1:A7').getRange()],
  [fWorksheet.getRange('A10').getRange()]
);
 
// Modify the data source of the sparkline to the range B1:B7, and move it to the range B10 after 3 seconds.
setTimeout(() => {
  sparkline.changeDataSource(
    fWorksheet.getRange('B1:B7').getRange(),
    fWorksheet.getRange('B10').getRange()
  );
}, 3000);removeSparkline()
removeSparkline(): void;返回
void
Description
Delete the sparkline in the current cell
示例
const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
 
// Create a sparkline in the range A10, with the data source in the range A1:A7.
const sparkline = fWorksheet.addSparkline(
  [fWorksheet.getRange('A1:A7').getRange()],
  [fWorksheet.getRange('A10').getRange()]
);
 
// Remove the sparkline after 3 seconds.
setTimeout(() => {
  sparkline.removeSparkline();
}, 3000);