@gravity-ui/charts 1.17.0 → 1.18.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 (93) hide show
  1. package/dist/cjs/components/AxisY/prepare-axis-data.d.ts +2 -1
  2. package/dist/cjs/components/AxisY/prepare-axis-data.js +7 -6
  3. package/dist/cjs/components/AxisY/utils.js +1 -10
  4. package/dist/cjs/components/ChartInner/index.js +10 -5
  5. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -1
  6. package/dist/cjs/components/ChartInner/useChartInnerProps.js +2 -0
  7. package/dist/cjs/components/Tooltip/ChartTooltipContent.d.ts +1 -0
  8. package/dist/cjs/components/Tooltip/ChartTooltipContent.js +2 -2
  9. package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.d.ts +2 -1
  10. package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.js +3 -3
  11. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.d.ts +4 -3
  12. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.js +6 -9
  13. package/dist/cjs/components/Tooltip/index.js +1 -1
  14. package/dist/cjs/hooks/useAxisScales/index.d.ts +3 -3
  15. package/dist/cjs/hooks/useAxisScales/index.js +40 -7
  16. package/dist/cjs/hooks/useChartOptions/index.d.ts +3 -1
  17. package/dist/cjs/hooks/useChartOptions/index.js +3 -3
  18. package/dist/cjs/hooks/useChartOptions/tooltip.d.ts +4 -1
  19. package/dist/cjs/hooks/useChartOptions/tooltip.js +18 -3
  20. package/dist/cjs/hooks/useChartOptions/x-axis.js +21 -9
  21. package/dist/cjs/hooks/useChartOptions/y-axis.js +20 -7
  22. package/dist/cjs/hooks/useCrosshair/index.d.ts +1 -1
  23. package/dist/cjs/hooks/useCrosshair/index.js +2 -1
  24. package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +1 -1
  25. package/dist/cjs/hooks/useShapes/area/prepare-data.js +3 -0
  26. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.d.ts +1 -1
  27. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +3 -0
  28. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.d.ts +1 -1
  29. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +8 -1
  30. package/dist/cjs/hooks/useShapes/index.d.ts +1 -1
  31. package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +1 -1
  32. package/dist/cjs/hooks/useShapes/line/prepare-data.js +3 -0
  33. package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +1 -1
  34. package/dist/cjs/hooks/useShapes/scatter/prepare-data.js +6 -0
  35. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.d.ts +1 -1
  36. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +6 -3
  37. package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
  38. package/dist/cjs/hooks/useZoom/types.d.ts +1 -1
  39. package/dist/cjs/hooks/useZoom/utils.d.ts +1 -1
  40. package/dist/cjs/hooks/useZoom/utils.js +22 -10
  41. package/dist/cjs/types/chart/tooltip.d.ts +3 -0
  42. package/dist/cjs/utils/chart/array.d.ts +1 -0
  43. package/dist/cjs/utils/chart/array.js +9 -0
  44. package/dist/cjs/utils/chart/index.d.ts +1 -0
  45. package/dist/cjs/utils/chart/index.js +1 -0
  46. package/dist/cjs/utils/chart/zoom.js +14 -8
  47. package/dist/esm/components/AxisY/prepare-axis-data.d.ts +2 -1
  48. package/dist/esm/components/AxisY/prepare-axis-data.js +7 -6
  49. package/dist/esm/components/AxisY/utils.js +1 -10
  50. package/dist/esm/components/ChartInner/index.js +10 -5
  51. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -1
  52. package/dist/esm/components/ChartInner/useChartInnerProps.js +2 -0
  53. package/dist/esm/components/Tooltip/ChartTooltipContent.d.ts +1 -0
  54. package/dist/esm/components/Tooltip/ChartTooltipContent.js +2 -2
  55. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.d.ts +2 -1
  56. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.js +3 -3
  57. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.d.ts +4 -3
  58. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.js +6 -9
  59. package/dist/esm/components/Tooltip/index.js +1 -1
  60. package/dist/esm/hooks/useAxisScales/index.d.ts +3 -3
  61. package/dist/esm/hooks/useAxisScales/index.js +40 -7
  62. package/dist/esm/hooks/useChartOptions/index.d.ts +3 -1
  63. package/dist/esm/hooks/useChartOptions/index.js +3 -3
  64. package/dist/esm/hooks/useChartOptions/tooltip.d.ts +4 -1
  65. package/dist/esm/hooks/useChartOptions/tooltip.js +18 -3
  66. package/dist/esm/hooks/useChartOptions/x-axis.js +21 -9
  67. package/dist/esm/hooks/useChartOptions/y-axis.js +20 -7
  68. package/dist/esm/hooks/useCrosshair/index.d.ts +1 -1
  69. package/dist/esm/hooks/useCrosshair/index.js +2 -1
  70. package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +1 -1
  71. package/dist/esm/hooks/useShapes/area/prepare-data.js +3 -0
  72. package/dist/esm/hooks/useShapes/bar-x/prepare-data.d.ts +1 -1
  73. package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +3 -0
  74. package/dist/esm/hooks/useShapes/bar-y/prepare-data.d.ts +1 -1
  75. package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +8 -1
  76. package/dist/esm/hooks/useShapes/index.d.ts +1 -1
  77. package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +1 -1
  78. package/dist/esm/hooks/useShapes/line/prepare-data.js +3 -0
  79. package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +1 -1
  80. package/dist/esm/hooks/useShapes/scatter/prepare-data.js +6 -0
  81. package/dist/esm/hooks/useShapes/waterfall/prepare-data.d.ts +1 -1
  82. package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +6 -3
  83. package/dist/esm/hooks/useZoom/index.d.ts +1 -1
  84. package/dist/esm/hooks/useZoom/types.d.ts +1 -1
  85. package/dist/esm/hooks/useZoom/utils.d.ts +1 -1
  86. package/dist/esm/hooks/useZoom/utils.js +22 -10
  87. package/dist/esm/types/chart/tooltip.d.ts +3 -0
  88. package/dist/esm/utils/chart/array.d.ts +1 -0
  89. package/dist/esm/utils/chart/array.js +9 -0
  90. package/dist/esm/utils/chart/index.d.ts +1 -0
  91. package/dist/esm/utils/chart/index.js +1 -0
  92. package/dist/esm/utils/chart/zoom.js +14 -8
  93. package/package.json +1 -1
@@ -76,14 +76,20 @@ export function getZoomedSeriesData(args) {
76
76
  const yAxisIndex = 'yAxis' in seriesItem && typeof seriesItem.yAxis === 'number'
77
77
  ? seriesItem.yAxis
78
78
  : 0;
79
- const [yMin, yMax] = zoomState.y[yAxisIndex];
80
- const y = 'y' in point ? point.y : undefined;
81
- inYRange = isValueInRange({
82
- axis: yAxes === null || yAxes === void 0 ? void 0 : yAxes[yAxisIndex],
83
- value: y,
84
- min: yMin,
85
- max: yMax,
86
- });
79
+ const zoomStateY = zoomState.y[yAxisIndex];
80
+ if (zoomStateY) {
81
+ const [yMin, yMax] = zoomStateY;
82
+ const y = 'y' in point ? point.y : undefined;
83
+ inYRange = isValueInRange({
84
+ axis: yAxes === null || yAxes === void 0 ? void 0 : yAxes[yAxisIndex],
85
+ value: y,
86
+ min: yMin,
87
+ max: yMax,
88
+ });
89
+ }
90
+ else {
91
+ inYRange = false;
92
+ }
87
93
  }
88
94
  currentPointInRange = inXRange && inYRange;
89
95
  if (currentPointInRange) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/charts",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "React component used to render charts",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",