@hitachivantara/uikit-react-viz 5.3.19 → 5.4.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 (62) hide show
  1. package/dist/cjs/components/BarChart/BarChart.cjs +9 -5
  2. package/dist/cjs/components/BarChart/BarChart.cjs.map +1 -1
  3. package/dist/cjs/components/BaseChart/BaseChart.cjs +28 -4
  4. package/dist/cjs/components/BaseChart/BaseChart.cjs.map +1 -1
  5. package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.cjs +171 -0
  6. package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.cjs.map +1 -0
  7. package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.styles.cjs +29 -0
  8. package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.styles.cjs.map +1 -0
  9. package/dist/cjs/components/ConfusionMatrix/utils.cjs +136 -0
  10. package/dist/cjs/components/ConfusionMatrix/utils.cjs.map +1 -0
  11. package/dist/cjs/components/DonutChart/DonutChart.cjs +5 -1
  12. package/dist/cjs/components/DonutChart/DonutChart.cjs.map +1 -1
  13. package/dist/cjs/components/LineChart/LineChart.cjs +8 -4
  14. package/dist/cjs/components/LineChart/LineChart.cjs.map +1 -1
  15. package/dist/cjs/hooks/tooltip/useTooltip.cjs +3 -3
  16. package/dist/cjs/hooks/tooltip/useTooltip.cjs.map +1 -1
  17. package/dist/cjs/hooks/useData.cjs +12 -2
  18. package/dist/cjs/hooks/useData.cjs.map +1 -1
  19. package/dist/cjs/hooks/useGrid.cjs +10 -2
  20. package/dist/cjs/hooks/useGrid.cjs.map +1 -1
  21. package/dist/cjs/hooks/useVisualMap.cjs +45 -0
  22. package/dist/cjs/hooks/useVisualMap.cjs.map +1 -0
  23. package/dist/cjs/hooks/useXAxis.cjs +43 -11
  24. package/dist/cjs/hooks/useXAxis.cjs.map +1 -1
  25. package/dist/cjs/hooks/useYAxis.cjs +50 -27
  26. package/dist/cjs/hooks/useYAxis.cjs.map +1 -1
  27. package/dist/cjs/index.cjs +2 -0
  28. package/dist/cjs/index.cjs.map +1 -1
  29. package/dist/cjs/utils/registerTheme.cjs +18 -1
  30. package/dist/cjs/utils/registerTheme.cjs.map +1 -1
  31. package/dist/esm/components/BarChart/BarChart.js +9 -5
  32. package/dist/esm/components/BarChart/BarChart.js.map +1 -1
  33. package/dist/esm/components/BaseChart/BaseChart.js +28 -4
  34. package/dist/esm/components/BaseChart/BaseChart.js.map +1 -1
  35. package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.js +152 -0
  36. package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.js.map +1 -0
  37. package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.styles.js +29 -0
  38. package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.styles.js.map +1 -0
  39. package/dist/esm/components/ConfusionMatrix/utils.js +136 -0
  40. package/dist/esm/components/ConfusionMatrix/utils.js.map +1 -0
  41. package/dist/esm/components/DonutChart/DonutChart.js +5 -1
  42. package/dist/esm/components/DonutChart/DonutChart.js.map +1 -1
  43. package/dist/esm/components/LineChart/LineChart.js +8 -4
  44. package/dist/esm/components/LineChart/LineChart.js.map +1 -1
  45. package/dist/esm/hooks/tooltip/useTooltip.js +3 -3
  46. package/dist/esm/hooks/tooltip/useTooltip.js.map +1 -1
  47. package/dist/esm/hooks/useData.js +12 -2
  48. package/dist/esm/hooks/useData.js.map +1 -1
  49. package/dist/esm/hooks/useGrid.js +10 -2
  50. package/dist/esm/hooks/useGrid.js.map +1 -1
  51. package/dist/esm/hooks/useVisualMap.js +45 -0
  52. package/dist/esm/hooks/useVisualMap.js.map +1 -0
  53. package/dist/esm/hooks/useXAxis.js +43 -11
  54. package/dist/esm/hooks/useXAxis.js.map +1 -1
  55. package/dist/esm/hooks/useYAxis.js +51 -28
  56. package/dist/esm/hooks/useYAxis.js.map +1 -1
  57. package/dist/esm/index.js +2 -0
  58. package/dist/esm/index.js.map +1 -1
  59. package/dist/esm/utils/registerTheme.js +18 -1
  60. package/dist/esm/utils/registerTheme.js.map +1 -1
  61. package/dist/types/index.d.ts +121 -6
  62. package/package.json +3 -3
@@ -32,6 +32,9 @@ declare interface BaseMeasures {
32
32
  valueFormatter?: (value?: string | number) => string;
33
33
  }
34
34
 
35
+ declare interface ConfusionMatrixMeasure extends BaseMeasures {
36
+ }
37
+
35
38
  declare interface DonutFullMeasures extends BaseMeasures {
36
39
  }
37
40
 
@@ -50,9 +53,9 @@ declare interface HvAxisChartCommonProps {
50
53
  /** Columns to use to split the measures. */
51
54
  splitBy?: Arrayable<string>;
52
55
  /** Options for the xAxis, i.e. the horizontal axis. */
53
- xAxis?: HvChartAxis;
56
+ xAxis?: HvChartXAxis;
54
57
  /** Options for the yAxis, i.e. the vertical axis. */
55
- yAxis?: HvChartAxis | [HvChartAxis, HvChartAxis];
58
+ yAxis?: HvChartYAxis | [HvChartYAxis, HvChartYAxis];
56
59
  /** Stack name to use when all the series should be stacked together. If not provided, the series are not stacked. */
57
60
  stack?: string;
58
61
  /** Ranger slider options for the horizontal axis. */
@@ -64,7 +67,7 @@ declare interface HvAxisChartCommonProps {
64
67
  /**
65
68
  * A bar chart is a chart or graph that presents categorical data with rectangular bars.
66
69
  */
67
- export declare const HvBarChart: ({ yAxis, xAxis, horizontal, horizontalRangeSlider, grid, data, groupBy, splitBy, sortBy, stack, seriesNameFormatter, measures, legend, tooltip, classes, }: HvBarChartProps) => JSX_2.Element;
70
+ export declare const HvBarChart: ({ yAxis, xAxis, horizontal, horizontalRangeSlider, grid, data, groupBy, splitBy, sortBy, stack, seriesNameFormatter, measures, legend, tooltip, classes, height, width, }: HvBarChartProps) => JSX_2.Element;
68
71
 
69
72
  export declare interface HvBarChartClasses extends HvChartTooltipClasses {
70
73
  }
@@ -94,6 +97,21 @@ export declare interface HvChartAxis {
94
97
  labelRotation?: number;
95
98
  /** Name used for the axis. */
96
99
  name?: string;
100
+ /** Properties to customize the axis name. */
101
+ nameProps?: {
102
+ /** Location. */
103
+ location?: HvChartAxisNameLocation;
104
+ /** Padding. */
105
+ padding?: number | number[];
106
+ /** Color. You can use either an HEX or color name from the palette. */
107
+ color?: string;
108
+ /** Font size. */
109
+ fontSize?: number;
110
+ /** Font style. */
111
+ fontStyle?: "normal" | "italic";
112
+ /** Font weight. */
113
+ fontWeight?: number;
114
+ };
97
115
  /** Maximum value on the axis. Set this property to `max` to use the maximum data value. */
98
116
  maxValue?: string | number | "max" | ((obj: {
99
117
  max: string | number;
@@ -106,6 +124,8 @@ export declare interface HvChartAxis {
106
124
  }) => string | number);
107
125
  }
108
126
 
127
+ export declare type HvChartAxisNameLocation = "start" | "end" | "center";
128
+
109
129
  /**
110
130
  * Axis types:
111
131
  * continuous: continuous data
@@ -128,6 +148,10 @@ declare interface HvChartCommonProps {
128
148
  legend?: HvChartLegend;
129
149
  /** Grid options. */
130
150
  grid?: HvChartGrid;
151
+ /** Chart width. */
152
+ width?: number;
153
+ /** Chart height. */
154
+ height?: number;
131
155
  }
132
156
 
133
157
  /** Chart data */
@@ -189,19 +213,97 @@ declare type HvChartTooltipClasses = ExtractNames<typeof useClasses>;
189
213
  export declare interface HvChartTooltipParams {
190
214
  title?: string | number;
191
215
  series?: {
216
+ color?: string;
192
217
  name?: string;
193
218
  value?: string | number;
194
- color?: string;
195
219
  }[];
196
220
  }
197
221
 
198
222
  export declare type HvChartTooltipType = (typeof tooltipType)[number];
199
223
 
224
+ declare interface HvChartXAxis extends HvChartAxis {
225
+ /** Position of the axis. */
226
+ position?: "top" | "bottom";
227
+ }
228
+
229
+ declare interface HvChartYAxis extends HvChartAxis {
230
+ /** Position of the axis. */
231
+ position?: "left" | "right";
232
+ }
233
+
234
+ /**
235
+ * Confusion Matrix is a table displaying the performance of a predictive model.
236
+ * Typically the columns show the predicted class and the rows the expected class.
237
+ * The main diagonal counts the positive matches while the cells outside it count the mismatches between predicted and expected.
238
+ */
239
+ export declare const HvConfusionMatrix: ({ legend, groupBy, measure, sortBy, splitBy, grid, data: dataProp, tooltip, xAxis, yAxis, colorScale: colorScaleProp, delta, valuesProps, width, height, format, classes: classesProp, }: HvConfusionMatrixProps) => JSX_2.Element;
240
+
241
+ export declare type HvConfusionMatrixClasses = ExtractNames<typeof useClasses_2>;
242
+
243
+ export declare interface HvConfusionMatrixColorScale {
244
+ /** You can use either an HEX or color name from the palette. */
245
+ color: string;
246
+ label: string;
247
+ max?: number;
248
+ min?: number;
249
+ value?: number;
250
+ }
251
+
252
+ export declare type HvConfusionMatrixFormat = "square" | "landscape";
253
+
254
+ export declare type HvConfusionMatrixMeasure = string | ConfusionMatrixMeasure;
255
+
256
+ export declare interface HvConfusionMatrixProps extends Omit<HvChartCommonProps, "tooltip"> {
257
+ /** Column to measure. */
258
+ measure: HvConfusionMatrixMeasure;
259
+ /** Columns to use to split the measure. */
260
+ splitBy?: Arrayable<string>;
261
+ /**
262
+ * Column to use for the delta confusion matrix.
263
+ *
264
+ * It can be set to `true` in case the `measure` already has the calculations for the delta confusion matrix.
265
+ */
266
+ delta?: boolean | string;
267
+ /** Options for the xAxis, i.e. the horizontal axis. */
268
+ xAxis?: HvChartXAxis;
269
+ /** Options for the yAxis, i.e. the vertical axis. */
270
+ yAxis?: HvChartYAxis;
271
+ /** Tooltip options. */
272
+ tooltip?: Omit<HvChartTooltip, "type">;
273
+ /** Format of the confusion matrix. Defaults to `square`. */
274
+ format?: HvConfusionMatrixFormat;
275
+ /** Properties to customize the prediction values. */
276
+ valuesProps?: HvConfusionMatrixValuesProps;
277
+ /** A Jss Object used to override or extend the styles applied to the component. */
278
+ classes?: HvConfusionMatrixClasses;
279
+ /**
280
+ * Color scale of the confusion matrix.
281
+ *
282
+ * If an array of two strings is provided, the first and second values are the lower and upper ends of the scale, respectively.
283
+ * An array of objects can also be used to create a custom scale.
284
+ * If `delta` is not provided, a default color scale is used when `colorScale` is not defined: `[base-light, cat3]`.
285
+ */
286
+ colorScale?: [string, string] | HvConfusionMatrixColorScale[];
287
+ }
288
+
289
+ export declare interface HvConfusionMatrixValuesProps {
290
+ /** Whether to show the prediction values inside the confusion matrix or not. Defaults to `true`. */
291
+ show?: boolean;
292
+ /** Prediction values label color. You can use either an HEX or color name from the palette. */
293
+ color?: string;
294
+ /** Prediction values label font style. */
295
+ fontStyle?: "normal" | "italic";
296
+ /** Prediction values label font weight. */
297
+ fontWeight?: number;
298
+ /** Prediction values label font size. */
299
+ fontSize?: number;
300
+ }
301
+
200
302
  /**
201
303
  * Donut charts nicely convey the part-whole relationship and they have become
202
304
  * the most recognizable chart types for representing proportions in business and data statistics.
203
305
  */
204
- export declare const HvDonutChart: ({ data, groupBy, classes, legend, tooltip, measure: measures, sortBy, grid, type, slicesNameFormatter, }: HvDonutChartProps) => JSX_2.Element;
306
+ export declare const HvDonutChart: ({ data, groupBy, classes, legend, tooltip, measure: measures, sortBy, grid, width, height, type, slicesNameFormatter, }: HvDonutChartProps) => JSX_2.Element;
205
307
 
206
308
  export declare interface HvDonutChartClasses extends HvChartTooltipClasses {
207
309
  }
@@ -223,7 +325,7 @@ export declare interface HvDonutChartProps extends HvChartCommonProps {
223
325
  * A line chart or line plot or line graph is a type of chart which displays information as a series of data points
224
326
  * connected by straight line segments. It is a basic type of chart common in many fields.
225
327
  */
226
- export declare const HvLineChart: ({ area, emptyCellMode, areaOpacity, yAxis, xAxis, horizontalRangeSlider, grid, data, groupBy, splitBy, sortBy, measures, stack, seriesNameFormatter, legend, classes, tooltip, }: HvLineChartProps) => JSX_2.Element;
328
+ export declare const HvLineChart: ({ area, emptyCellMode, areaOpacity, yAxis, xAxis, horizontalRangeSlider, grid, data, groupBy, splitBy, sortBy, measures, stack, seriesNameFormatter, legend, classes, tooltip, width, height, }: HvLineChartProps) => JSX_2.Element;
227
329
 
228
330
  export declare interface HvLineChartClasses extends HvChartTooltipClasses {
229
331
  }
@@ -315,4 +417,17 @@ declare const useClasses: (classesProp?: Partial<Record<"singleTooltipRoot" | "s
315
417
  cx: (...args: any) => string;
316
418
  };
317
419
 
420
+ declare const useClasses_2: (classesProp?: Partial<Record<"tooltipRoot" | "tooltipContainer" | "tooltipText", string>>, addStatic?: boolean) => {
421
+ classes: {
422
+ tooltipRoot: string;
423
+ tooltipContainer: string;
424
+ tooltipText: string;
425
+ };
426
+ css: {
427
+ (template: TemplateStringsArray, ...args: CSSInterpolation[]): string;
428
+ (...args: CSSInterpolation[]): string;
429
+ };
430
+ cx: (...args: any) => string;
431
+ };
432
+
318
433
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-viz",
3
- "version": "5.3.19",
3
+ "version": "5.4.0",
4
4
  "private": false,
5
5
  "author": "Hitachi Vantara UI Kit Team",
6
6
  "description": "Contributed React visualization components for the NEXT UI Kit.",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@emotion/css": "^11.11.0",
36
- "@hitachivantara/uikit-react-core": "^5.25.3"
36
+ "@hitachivantara/uikit-react-core": "^5.26.0"
37
37
  },
38
38
  "files": [
39
39
  "dist"
@@ -42,7 +42,7 @@
42
42
  "access": "public",
43
43
  "directory": "package"
44
44
  },
45
- "gitHead": "55c7e43152d07b2cc3788b1383aa87a58e292973",
45
+ "gitHead": "b9b65e926b74ae9834d26017a487e72a621383c7",
46
46
  "main": "dist/cjs/index.cjs",
47
47
  "exports": {
48
48
  ".": {