h2o-library 2.2.1 → 2.3.0

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/charts/charts/src/bar/chart-bar.d.ts +14 -1
  3. package/dist/charts/charts/src/heatmap/chart-heatmap.d.ts +11 -3
  4. package/dist/charts/charts/src/line/chart-line.d.ts +12 -1
  5. package/dist/charts/charts/src/waterfall/chart-waterfall.d.ts +0 -4
  6. package/dist/charts/index.cjs.js +1 -1
  7. package/dist/charts/index.js +1 -1
  8. package/dist/charts/src/bar/chart-bar.d.ts +14 -1
  9. package/dist/charts/src/heatmap/chart-heatmap.d.ts +11 -3
  10. package/dist/charts/src/line/chart-line.d.ts +12 -1
  11. package/dist/charts/src/waterfall/chart-waterfall.d.ts +0 -4
  12. package/dist/esm/charts/src/bar/chart-bar.d.ts +14 -1
  13. package/dist/esm/charts/src/heatmap/chart-heatmap.d.ts +11 -3
  14. package/dist/esm/charts/src/line/chart-line.d.ts +12 -1
  15. package/dist/esm/charts/src/waterfall/chart-waterfall.d.ts +0 -4
  16. package/dist/hooks/charts/src/bar/chart-bar.d.ts +14 -1
  17. package/dist/hooks/charts/src/heatmap/chart-heatmap.d.ts +11 -3
  18. package/dist/hooks/charts/src/line/chart-line.d.ts +12 -1
  19. package/dist/hooks/charts/src/waterfall/chart-waterfall.d.ts +0 -4
  20. package/dist/types/charts/src/bar/chart-bar.d.ts +14 -1
  21. package/dist/types/charts/src/heatmap/chart-heatmap.d.ts +11 -3
  22. package/dist/types/charts/src/line/chart-line.d.ts +12 -1
  23. package/dist/types/charts/src/waterfall/chart-waterfall.d.ts +0 -4
  24. package/dist/utils/charts/src/bar/chart-bar.d.ts +14 -1
  25. package/dist/utils/charts/src/heatmap/chart-heatmap.d.ts +11 -3
  26. package/dist/utils/charts/src/line/chart-line.d.ts +12 -1
  27. package/dist/utils/charts/src/waterfall/chart-waterfall.d.ts +0 -4
  28. package/package.json +1 -1
@@ -1,9 +1,16 @@
1
1
  import React from "react";
2
2
  import "../../charts.css";
3
+ /**
4
+ * A cell value. A `number` is colored by intensity as usual. A `string` is a
5
+ * final, non-numeric result straight from the backend (e.g. "N/A" for a
6
+ * percentage whose denominator is 0) — it is shown verbatim in a neutral,
7
+ * grayed-out cell and excluded from the color scale.
8
+ */
9
+ export type HeatmapCell = number | string;
3
10
  export interface HeatmapData {
4
11
  rows: string[];
5
12
  columns: string[];
6
- matrix: number[][];
13
+ matrix: HeatmapCell[][];
7
14
  }
8
15
  export interface HeatmapChartProps {
9
16
  data: HeatmapData;
@@ -13,6 +20,7 @@ export interface HeatmapChartProps {
13
20
  className?: string;
14
21
  onRowClick?: (row: string, event: React.MouseEvent<HTMLDivElement>) => void;
15
22
  onColumnClick?: (column: string, event: React.MouseEvent<HTMLDivElement>) => void;
16
- onCellClick?: (row: string, column: string, value: number, event: React.MouseEvent<HTMLDivElement>) => void;
23
+ onCellClick?: (row: string, column: string, value: HeatmapCell, event: React.MouseEvent<HTMLDivElement>) => void;
24
+ formatCell?: (value: HeatmapCell, row: string, column: string) => React.ReactNode;
17
25
  }
18
- export declare const HeatmapChart: ({ data, showValue, showPercentage, height, className, onRowClick, onColumnClick, onCellClick, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const HeatmapChart: ({ data, showValue, showPercentage, height, className, onRowClick, onColumnClick, onCellClick, formatCell, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -23,6 +23,17 @@ export interface LineChartProps {
23
23
  className?: string;
24
24
  onXAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
25
25
  onYAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
26
+ xAxisTickFormatter?: (value: string | number) => string;
27
+ yAxisTickFormatter?: (value: string | number) => string;
28
+ yAxisDomain?: [number | "auto", number | "auto"];
29
+ tooltipFormatter?: LineTooltipFormatter;
26
30
  onDataPointClick?: (point: LineChartDataPoint, index: number, dataKey: string, event: React.MouseEvent<SVGCircleElement>) => void;
27
31
  }
28
- export declare const LineChart: ({ data, lines, showGrid, showLegend, showGradient, height, showTooltipLabel, className, onXAxisTickClick, onYAxisTickClick, onDataPointClick, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
32
+ export type LineTooltipFormatter = (value: number, ctx: {
33
+ dataKey: string;
34
+ name: string;
35
+ unit?: string;
36
+ label: string;
37
+ point: LineChartDataPoint;
38
+ }) => React.ReactNode;
39
+ export declare const LineChart: ({ data, lines, showGrid, showLegend, showGradient, height, showTooltipLabel, className, onXAxisTickClick, onYAxisTickClick, xAxisTickFormatter, yAxisTickFormatter, yAxisDomain, tooltipFormatter, onDataPointClick, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -26,13 +26,9 @@ export interface ShapExplanation {
26
26
  recordId?: number;
27
27
  losRecordId?: number;
28
28
  probabilityDischargeNext2Days?: number;
29
- /** f(x) — model output probability. */
30
29
  fx: number;
31
- /** E(f(x)) — baseline (expected) probability. */
32
30
  efx: number;
33
- /** Summed contribution of all features not individually listed. */
34
31
  otherFactorsProb?: number;
35
- /** Count of features grouped into otherFactors. */
36
32
  otherFactorsValue?: number;
37
33
  text?: string;
38
34
  features: ShapFeature[];
@@ -10,6 +10,8 @@ export interface BarSeriesConfig {
10
10
  color: string;
11
11
  unit?: string;
12
12
  stackId?: string;
13
+ labelKey?: string;
14
+ labelColor?: string;
13
15
  }
14
16
  export interface BarChartProps {
15
17
  data: BarChartDataPoint[];
@@ -22,6 +24,17 @@ export interface BarChartProps {
22
24
  className?: string;
23
25
  onXAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
24
26
  onYAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
27
+ xAxisTickFormatter?: (value: string | number) => string;
28
+ yAxisTickFormatter?: (value: string | number) => string;
29
+ yAxisDomain?: [number | "auto", number | "auto"];
30
+ tooltipFormatter?: BarTooltipFormatter;
25
31
  onBarClick?: (dataPoint: BarChartDataPoint, index: number, dataKey: string, event: React.MouseEvent<SVGElement>) => void;
26
32
  }
27
- export declare const BarChart: ({ data, bars, layout, orientation, showGrid, showLegend, height, className, onXAxisTickClick, onYAxisTickClick, onBarClick, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
33
+ export type BarTooltipFormatter = (value: number, ctx: {
34
+ dataKey: string;
35
+ name: string;
36
+ unit?: string;
37
+ label: string;
38
+ dataPoint: BarChartDataPoint;
39
+ }) => React.ReactNode;
40
+ export declare const BarChart: ({ data, bars, layout, orientation, showGrid, showLegend, height, className, onXAxisTickClick, onYAxisTickClick, xAxisTickFormatter, yAxisTickFormatter, yAxisDomain, tooltipFormatter, onBarClick, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,16 @@
1
1
  import React from "react";
2
2
  import "../../charts.css";
3
+ /**
4
+ * A cell value. A `number` is colored by intensity as usual. A `string` is a
5
+ * final, non-numeric result straight from the backend (e.g. "N/A" for a
6
+ * percentage whose denominator is 0) — it is shown verbatim in a neutral,
7
+ * grayed-out cell and excluded from the color scale.
8
+ */
9
+ export type HeatmapCell = number | string;
3
10
  export interface HeatmapData {
4
11
  rows: string[];
5
12
  columns: string[];
6
- matrix: number[][];
13
+ matrix: HeatmapCell[][];
7
14
  }
8
15
  export interface HeatmapChartProps {
9
16
  data: HeatmapData;
@@ -13,6 +20,7 @@ export interface HeatmapChartProps {
13
20
  className?: string;
14
21
  onRowClick?: (row: string, event: React.MouseEvent<HTMLDivElement>) => void;
15
22
  onColumnClick?: (column: string, event: React.MouseEvent<HTMLDivElement>) => void;
16
- onCellClick?: (row: string, column: string, value: number, event: React.MouseEvent<HTMLDivElement>) => void;
23
+ onCellClick?: (row: string, column: string, value: HeatmapCell, event: React.MouseEvent<HTMLDivElement>) => void;
24
+ formatCell?: (value: HeatmapCell, row: string, column: string) => React.ReactNode;
17
25
  }
18
- export declare const HeatmapChart: ({ data, showValue, showPercentage, height, className, onRowClick, onColumnClick, onCellClick, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const HeatmapChart: ({ data, showValue, showPercentage, height, className, onRowClick, onColumnClick, onCellClick, formatCell, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -23,6 +23,17 @@ export interface LineChartProps {
23
23
  className?: string;
24
24
  onXAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
25
25
  onYAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
26
+ xAxisTickFormatter?: (value: string | number) => string;
27
+ yAxisTickFormatter?: (value: string | number) => string;
28
+ yAxisDomain?: [number | "auto", number | "auto"];
29
+ tooltipFormatter?: LineTooltipFormatter;
26
30
  onDataPointClick?: (point: LineChartDataPoint, index: number, dataKey: string, event: React.MouseEvent<SVGCircleElement>) => void;
27
31
  }
28
- export declare const LineChart: ({ data, lines, showGrid, showLegend, showGradient, height, showTooltipLabel, className, onXAxisTickClick, onYAxisTickClick, onDataPointClick, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
32
+ export type LineTooltipFormatter = (value: number, ctx: {
33
+ dataKey: string;
34
+ name: string;
35
+ unit?: string;
36
+ label: string;
37
+ point: LineChartDataPoint;
38
+ }) => React.ReactNode;
39
+ export declare const LineChart: ({ data, lines, showGrid, showLegend, showGradient, height, showTooltipLabel, className, onXAxisTickClick, onYAxisTickClick, xAxisTickFormatter, yAxisTickFormatter, yAxisDomain, tooltipFormatter, onDataPointClick, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -26,13 +26,9 @@ export interface ShapExplanation {
26
26
  recordId?: number;
27
27
  losRecordId?: number;
28
28
  probabilityDischargeNext2Days?: number;
29
- /** f(x) — model output probability. */
30
29
  fx: number;
31
- /** E(f(x)) — baseline (expected) probability. */
32
30
  efx: number;
33
- /** Summed contribution of all features not individually listed. */
34
31
  otherFactorsProb?: number;
35
- /** Count of features grouped into otherFactors. */
36
32
  otherFactorsValue?: number;
37
33
  text?: string;
38
34
  features: ShapFeature[];
@@ -10,6 +10,8 @@ export interface BarSeriesConfig {
10
10
  color: string;
11
11
  unit?: string;
12
12
  stackId?: string;
13
+ labelKey?: string;
14
+ labelColor?: string;
13
15
  }
14
16
  export interface BarChartProps {
15
17
  data: BarChartDataPoint[];
@@ -22,6 +24,17 @@ export interface BarChartProps {
22
24
  className?: string;
23
25
  onXAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
24
26
  onYAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
27
+ xAxisTickFormatter?: (value: string | number) => string;
28
+ yAxisTickFormatter?: (value: string | number) => string;
29
+ yAxisDomain?: [number | "auto", number | "auto"];
30
+ tooltipFormatter?: BarTooltipFormatter;
25
31
  onBarClick?: (dataPoint: BarChartDataPoint, index: number, dataKey: string, event: React.MouseEvent<SVGElement>) => void;
26
32
  }
27
- export declare const BarChart: ({ data, bars, layout, orientation, showGrid, showLegend, height, className, onXAxisTickClick, onYAxisTickClick, onBarClick, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
33
+ export type BarTooltipFormatter = (value: number, ctx: {
34
+ dataKey: string;
35
+ name: string;
36
+ unit?: string;
37
+ label: string;
38
+ dataPoint: BarChartDataPoint;
39
+ }) => React.ReactNode;
40
+ export declare const BarChart: ({ data, bars, layout, orientation, showGrid, showLegend, height, className, onXAxisTickClick, onYAxisTickClick, xAxisTickFormatter, yAxisTickFormatter, yAxisDomain, tooltipFormatter, onBarClick, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,16 @@
1
1
  import React from "react";
2
2
  import "../../charts.css";
3
+ /**
4
+ * A cell value. A `number` is colored by intensity as usual. A `string` is a
5
+ * final, non-numeric result straight from the backend (e.g. "N/A" for a
6
+ * percentage whose denominator is 0) — it is shown verbatim in a neutral,
7
+ * grayed-out cell and excluded from the color scale.
8
+ */
9
+ export type HeatmapCell = number | string;
3
10
  export interface HeatmapData {
4
11
  rows: string[];
5
12
  columns: string[];
6
- matrix: number[][];
13
+ matrix: HeatmapCell[][];
7
14
  }
8
15
  export interface HeatmapChartProps {
9
16
  data: HeatmapData;
@@ -13,6 +20,7 @@ export interface HeatmapChartProps {
13
20
  className?: string;
14
21
  onRowClick?: (row: string, event: React.MouseEvent<HTMLDivElement>) => void;
15
22
  onColumnClick?: (column: string, event: React.MouseEvent<HTMLDivElement>) => void;
16
- onCellClick?: (row: string, column: string, value: number, event: React.MouseEvent<HTMLDivElement>) => void;
23
+ onCellClick?: (row: string, column: string, value: HeatmapCell, event: React.MouseEvent<HTMLDivElement>) => void;
24
+ formatCell?: (value: HeatmapCell, row: string, column: string) => React.ReactNode;
17
25
  }
18
- export declare const HeatmapChart: ({ data, showValue, showPercentage, height, className, onRowClick, onColumnClick, onCellClick, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const HeatmapChart: ({ data, showValue, showPercentage, height, className, onRowClick, onColumnClick, onCellClick, formatCell, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -23,6 +23,17 @@ export interface LineChartProps {
23
23
  className?: string;
24
24
  onXAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
25
25
  onYAxisTickClick?: (value: string | number, event: React.MouseEvent) => void;
26
+ xAxisTickFormatter?: (value: string | number) => string;
27
+ yAxisTickFormatter?: (value: string | number) => string;
28
+ yAxisDomain?: [number | "auto", number | "auto"];
29
+ tooltipFormatter?: LineTooltipFormatter;
26
30
  onDataPointClick?: (point: LineChartDataPoint, index: number, dataKey: string, event: React.MouseEvent<SVGCircleElement>) => void;
27
31
  }
28
- export declare const LineChart: ({ data, lines, showGrid, showLegend, showGradient, height, showTooltipLabel, className, onXAxisTickClick, onYAxisTickClick, onDataPointClick, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
32
+ export type LineTooltipFormatter = (value: number, ctx: {
33
+ dataKey: string;
34
+ name: string;
35
+ unit?: string;
36
+ label: string;
37
+ point: LineChartDataPoint;
38
+ }) => React.ReactNode;
39
+ export declare const LineChart: ({ data, lines, showGrid, showLegend, showGradient, height, showTooltipLabel, className, onXAxisTickClick, onYAxisTickClick, xAxisTickFormatter, yAxisTickFormatter, yAxisDomain, tooltipFormatter, onDataPointClick, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -26,13 +26,9 @@ export interface ShapExplanation {
26
26
  recordId?: number;
27
27
  losRecordId?: number;
28
28
  probabilityDischargeNext2Days?: number;
29
- /** f(x) — model output probability. */
30
29
  fx: number;
31
- /** E(f(x)) — baseline (expected) probability. */
32
30
  efx: number;
33
- /** Summed contribution of all features not individually listed. */
34
31
  otherFactorsProb?: number;
35
- /** Count of features grouped into otherFactors. */
36
32
  otherFactorsValue?: number;
37
33
  text?: string;
38
34
  features: ShapFeature[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h2o-library",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "A set of components for H2O Apps development",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/esm/index.js",