ws.sparklines
WorksheetSparklines
Sub-API for sparkline operations on a worksheet.
18 methods
add
→ Promise<Sparkline>add(
cell: { row: number; col: number },
dataRange: CellRange,
type: SparklineType,
options?: CreateSparklineOptions,
): Promise<Sparkline>;| Parameter | Type | Required |
|---|---|---|
| cell | { row: number; col: number } | required |
| dataRange | CellRange | required |
| type | SparklineType | required |
| options | CreateSparklineOptions | optional |
Add a sparkline to a cell. @param cell - Cell position (row and col, 0-based) @param dataRange - Data range for the sparkline @param type - Sparkline type (line, column, winLoss) @param options - Optional creation settings @returns The created sparkline
addGroup
→ Promise<SparklineGroup>addGroup(
cells: Array<{ row: number; col: number }>,
dataRanges: CellRange[],
type: SparklineType,
options?: CreateSparklineGroupOptions,
): Promise<SparklineGroup>;| Parameter | Type | Required |
|---|---|---|
| cells | Array<{ row: number; col: number }> | required |
| dataRanges | CellRange[] | required |
| type | SparklineType | required |
| options | CreateSparklineGroupOptions | optional |
Add a group of sparklines with shared settings. @param cells - Array of cell positions @param dataRanges - Array of data ranges (must match cells length) @param type - Sparkline type @param options - Optional group creation settings @returns The created sparkline group
get
→ Promise<Sparkline | null>get(sparklineId: string): Promise<Sparkline | null>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
Get a sparkline by ID. @param sparklineId - Sparkline identifier @returns The sparkline, or null if not found
getAtCell
→ Promise<Sparkline | null>getAtCell(row: number, col: number): Promise<Sparkline | null>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
| col | number | required |
Get the sparkline at a specific cell. @param row - Row index (0-based) @param col - Column index (0-based) @returns The sparkline at the cell, or null if none
list
→ Promise<Sparkline[]>list(): Promise<Sparkline[]>;List all sparklines in the worksheet. @returns Array of all sparklines
getGroup
→ Promise<SparklineGroup | null>getGroup(groupId: string): Promise<SparklineGroup | null>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
Get a sparkline group by ID. @param groupId - Group identifier @returns The sparkline group, or null if not found
listGroups
→ Promise<SparklineGroup[]>listGroups(): Promise<SparklineGroup[]>;List all sparkline groups in the worksheet. @returns Array of all sparkline groups
update
→ Promise<void>update(sparklineId: string, updates: Partial<Sparkline>): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
| updates | Partial<Sparkline> | required |
Update a sparkline's settings. @param sparklineId - Sparkline identifier @param updates - Partial sparkline properties to update
updateGroup
→ Promise<void>updateGroup(groupId: string, updates: Partial<SparklineGroup>): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
| updates | Partial<SparklineGroup> | required |
Update a sparkline group's settings (applies to all members). @param groupId - Group identifier @param updates - Partial group properties to update
remove
→ Promise<void>remove(sparklineId: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
Remove a sparkline. @param sparklineId - Sparkline identifier
removeGroup
→ Promise<void>removeGroup(groupId: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
Remove a sparkline group and all its member sparklines. @param groupId - Group identifier
clearInRange
→ Promise<void>clearInRange(range: CellRange): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| range | CellRange | required |
Clear all sparklines whose cell falls within a range. @param range - Range to clear sparklines from
clearAll
→ Promise<void>clearAll(): Promise<void>;Clear all sparklines in the worksheet.
addToGroup
→ Promise<void>addToGroup(sparklineId: string, groupId: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
| groupId | string | required |
Add a sparkline to a group. @param sparklineId - Sparkline identifier @param groupId - Group identifier
removeFromGroup
→ Promise<void>removeFromGroup(sparklineId: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
Remove a sparkline from its group (becomes standalone). @param sparklineId - Sparkline identifier
ungroupAll
→ Promise<string[]>ungroupAll(groupId: string): Promise<string[]>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
Ungroup all sparklines in a group (members become standalone). @param groupId - Group identifier @returns IDs of sparklines that were ungrouped
has
→ Promise<boolean>has(row: number, col: number): Promise<boolean>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
| col | number | required |
Check if a cell has a sparkline. @param row - Row index (0-based) @param col - Column index (0-based) @returns True if the cell has a sparkline
getWithDataInRange
→ Promise<Sparkline[]>getWithDataInRange(range: CellRange): Promise<Sparkline[]>;| Parameter | Type | Required |
|---|---|---|
| range | CellRange | required |
Get sparklines whose data range intersects with a given range. @param range - Range to check for data intersection @returns Sparklines with data in the range