shap-svg 0.2.2 → 0.2.3

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.
package/dist/index.d.cts CHANGED
@@ -337,6 +337,28 @@ declare function scalarFormatterLabels(locs: number[]): {
337
337
  offsetText?: string;
338
338
  };
339
339
 
340
+ type TooltipBox = {
341
+ x: number;
342
+ y: number;
343
+ width: number;
344
+ height: number;
345
+ };
346
+ /**
347
+ * Where a hover box goes: right of the point, flipped to its left when the
348
+ * chart's right edge would cut it off, and kept inside the chart top to bottom.
349
+ * Its width follows the longest line, so a long taxon name or a long label
350
+ * stays inside the box.
351
+ */
352
+ declare function placeTooltip(opts: {
353
+ anchorX: number;
354
+ anchorY: number;
355
+ lines: string[];
356
+ lineHeight: number;
357
+ minWidth: number;
358
+ chartWidth: number;
359
+ chartHeight: number;
360
+ }): TooltipBox;
361
+
340
362
  declare const BEESWARM_MISSING_COLOR = "#777777";
341
363
  declare const BEESWARM_ROW_HEIGHT = 0.4;
342
364
  type BeeswarmPoint = {
@@ -550,4 +572,4 @@ declare function heatmapRows(explanation: ParsedExplanation, maxDisplay: number,
550
572
  /** Projects heatmap value-space rows into SVG geometry. */
551
573
  declare function heatmapLayout(valueRows: HeatmapRows, opts: HeatmapLayoutOptions): HeatmapLayout;
552
574
 
553
- export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, PlotLabels, type Point, RowSort, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
575
+ export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, PlotLabels, type Point, RowSort, type TooltipBox, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, placeTooltip, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
package/dist/index.d.ts CHANGED
@@ -337,6 +337,28 @@ declare function scalarFormatterLabels(locs: number[]): {
337
337
  offsetText?: string;
338
338
  };
339
339
 
340
+ type TooltipBox = {
341
+ x: number;
342
+ y: number;
343
+ width: number;
344
+ height: number;
345
+ };
346
+ /**
347
+ * Where a hover box goes: right of the point, flipped to its left when the
348
+ * chart's right edge would cut it off, and kept inside the chart top to bottom.
349
+ * Its width follows the longest line, so a long taxon name or a long label
350
+ * stays inside the box.
351
+ */
352
+ declare function placeTooltip(opts: {
353
+ anchorX: number;
354
+ anchorY: number;
355
+ lines: string[];
356
+ lineHeight: number;
357
+ minWidth: number;
358
+ chartWidth: number;
359
+ chartHeight: number;
360
+ }): TooltipBox;
361
+
340
362
  declare const BEESWARM_MISSING_COLOR = "#777777";
341
363
  declare const BEESWARM_ROW_HEIGHT = 0.4;
342
364
  type BeeswarmPoint = {
@@ -550,4 +572,4 @@ declare function heatmapRows(explanation: ParsedExplanation, maxDisplay: number,
550
572
  /** Projects heatmap value-space rows into SVG geometry. */
551
573
  declare function heatmapLayout(valueRows: HeatmapRows, opts: HeatmapLayoutOptions): HeatmapLayout;
552
574
 
553
- export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, PlotLabels, type Point, RowSort, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
575
+ export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, PlotLabels, type Point, RowSort, type TooltipBox, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, placeTooltip, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ import {
27
27
  heatmapRows,
28
28
  orderFeatures,
29
29
  parseExplanation,
30
+ placeTooltip,
30
31
  resolveLabels,
31
32
  sampleColormap,
32
33
  scalarFormatterLabels,
@@ -34,7 +35,7 @@ import {
34
35
  sortDisplayRows,
35
36
  waterfallLayout,
36
37
  waterfallRows
37
- } from "./chunk-4X6PMJYT.js";
38
+ } from "./chunk-UVIVTJK3.js";
38
39
  export {
39
40
  BEESWARM_MISSING_COLOR,
40
41
  BEESWARM_ROW_HEIGHT,
@@ -64,6 +65,7 @@ export {
64
65
  heatmapRows,
65
66
  orderFeatures,
66
67
  parseExplanation,
68
+ placeTooltip,
67
69
  resolveLabels,
68
70
  sampleColormap,
69
71
  scalarFormatterLabels,