@i2analyze/notebook-sdk 1.9.0-dev.13 → 1.9.0-dev.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1096,6 +1096,23 @@ export declare namespace app {
1096
1096
  * @i2since 1.1
1097
1097
  */
1098
1098
  createGeoPoint(data: data.IGeoPointData): data.IGeoPoint;
1099
+ /**
1100
+ * Creates a color range from a configuration that maps brush indices to CSS color strings.
1101
+ *
1102
+ * @remarks
1103
+ * The returned color range resolves colors for any index within the range of the provided keys.
1104
+ * If an index matches a key exactly, its color is returned directly. If an index falls between
1105
+ * two keys, the color is interpolated linearly between the colors of the two nearest keys.
1106
+ *
1107
+ * This supports both discrete and continuous (gradient) color ranges, depending on the
1108
+ * configuration you provide. See {@link visual.ColorRangeConfig} for details.
1109
+ *
1110
+ * @param config - A mapping of brush indices to CSS color strings.
1111
+ * @returns A new color range.
1112
+ * @throws `Error` if the configuration is empty or contains invalid color strings.
1113
+ * @i2since 1.9
1114
+ */
1115
+ createBrushColorRange(config: visual.ColorRangeConfig): visual.IBrushColorRange;
1099
1116
  }
1100
1117
  /**
1101
1118
  * A set of methods for performing tracked mutations, which require an entry in the undo stack.
@@ -6510,12 +6527,35 @@ export declare namespace visual {
6510
6527
  /**
6511
6528
  * Returns the CSS color string for the given brush index.
6512
6529
  *
6530
+ * @remarks
6531
+ * The behavior of this method depends on the implementation. For color ranges created with
6532
+ * `app.IValueFactory.createBrushColorRange`, if the index matches a key exactly, the corresponding
6533
+ * color is returned; if it falls between two keys, the color is interpolated linearly between
6534
+ * the colors of the two nearest keys; and if it is outside the range of defined keys, an `Error`
6535
+ * is thrown.
6536
+ *
6513
6537
  * @param index - The brush index to get the color for.
6514
6538
  * @returns A CSS color string (for example, '#FF0000', 'rgb(255, 0, 0)', 'red').
6515
6539
  * @i2since 1.9
6516
6540
  */
6517
6541
  getColor(index: BrushIndex): string;
6518
6542
  }
6543
+ /**
6544
+ * A configuration for creating a color range, specified as a mapping of brush indices to CSS color strings.
6545
+ *
6546
+ * @remarks
6547
+ * The keys are brush indices and the values are CSS color strings. You must provide at least one entry.
6548
+ *
6549
+ * For a **discrete** color range, provide a color for every index you intend to use.
6550
+ * For example, `{ 0: '#FF0000', 1: '#00FF00', 2: '#0000FF' }` maps index 0 to red, 1 to green, and 2 to blue.
6551
+ *
6552
+ * For a **continuous** (gradient) color range, provide colors only at key indices.
6553
+ * For example, `{ 0: '#FF0000', 100: '#0000FF' }` maps index 0 to red and index 100 to blue;
6554
+ * intermediate indices are interpolated linearly between the two colors.
6555
+ *
6556
+ * @i2since 1.9
6557
+ */
6558
+ export type ColorRangeConfig = Record<BrushIndex, string>;
6519
6559
  /**
6520
6560
  * A brush set that maps records to brush indices and applies colors based on a color range.
6521
6561
  * @i2since 1.9
@@ -6549,25 +6589,28 @@ export declare namespace visual {
6549
6589
  /**
6550
6590
  * Sets the brush index for a single record.
6551
6591
  *
6552
- * @param recordId - The identifier of the record.
6592
+ * @param record - The record, or the identifier of the record.
6553
6593
  * @param index - The brush index to assign to the record.
6594
+ * @throws `Error` if the record does not exist on the chart.
6554
6595
  * @i2since 1.9
6555
6596
  */
6556
- set(recordId: records.AnalyzeRecordId, index: BrushIndex): void;
6597
+ set(record: app.RecordSpecifier, index: BrushIndex): void;
6557
6598
  /**
6558
6599
  * Sets the brush index for multiple records.
6559
6600
  *
6560
- * @param entries - An iterable of `[recordId, index]` tuples for multiple records.
6601
+ * @param entries - An iterable of `[record, index]` tuples for multiple records.
6602
+ * @throws `Error` if one or more of the records do not exist on the chart.
6561
6603
  * @i2since 1.9
6562
6604
  */
6563
- set(entries: Iterable<[records.AnalyzeRecordId, BrushIndex]>): void;
6605
+ set(entries: Iterable<[app.RecordSpecifier, BrushIndex]>): void;
6564
6606
  /**
6565
6607
  * Removes specific records from the brush set.
6566
6608
  *
6567
- * @param recordIds - An iterable of record identifiers to remove.
6609
+ * @param records - An iterable of records, or record identifiers, to remove.
6610
+ * @throws `Error` if one or more of the records do not exist on the chart.
6568
6611
  * @i2since 1.9
6569
6612
  */
6570
- remove(recordIds: Iterable<records.AnalyzeRecordId>): void;
6613
+ remove(records: Iterable<app.RecordSpecifier> | app.RecordSpecifier): void;
6571
6614
  /**
6572
6615
  * Gets the brush index for a record, or `undefined` if the record is not in the brush set.
6573
6616
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i2analyze/notebook-sdk",
3
- "version": "1.9.0-dev.13",
3
+ "version": "1.9.0-dev.15",
4
4
  "description": "i2 Notebook SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {