@mui/x-charts 6.0.0-alpha.2 → 6.0.0-alpha.4

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 (94) hide show
  1. package/BarChart/BarChart.d.ts +1 -4
  2. package/BarChart/BarChart.js +5 -3
  3. package/BarChart/BarPlot.js +42 -8
  4. package/CHANGELOG.md +301 -114
  5. package/ChartContainer/index.d.ts +3 -1
  6. package/ChartContainer/index.js +10 -6
  7. package/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
  8. package/LineChart/LineChart.d.ts +1 -4
  9. package/LineChart/LineChart.js +5 -3
  10. package/LineChart/extremums.js +2 -2
  11. package/ResponsiveChartContainer/index.d.ts +1 -1
  12. package/ResponsiveChartContainer/index.js +13 -11
  13. package/ScatterChart/Scatter.d.ts +1 -1
  14. package/ScatterChart/ScatterChart.d.ts +1 -4
  15. package/ScatterChart/ScatterChart.js +5 -3
  16. package/context/CartesianContextProvider.js +31 -20
  17. package/context/SeriesContextProvider.js +2 -2
  18. package/esm/BarChart/BarChart.js +3 -2
  19. package/esm/BarChart/BarPlot.js +44 -8
  20. package/esm/ChartContainer/index.js +7 -5
  21. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
  22. package/esm/LineChart/LineChart.js +3 -2
  23. package/esm/LineChart/extremums.js +2 -2
  24. package/esm/ResponsiveChartContainer/index.js +11 -10
  25. package/esm/ScatterChart/ScatterChart.js +3 -2
  26. package/esm/context/CartesianContextProvider.js +31 -18
  27. package/esm/context/SeriesContextProvider.js +2 -2
  28. package/esm/hooks/index.js +2 -0
  29. package/esm/hooks/useAxisEvents.js +12 -7
  30. package/esm/hooks/useDrawingArea.js +16 -0
  31. package/esm/hooks/useScale.js +19 -21
  32. package/esm/hooks/useTicks.js +26 -13
  33. package/esm/index.js +1 -0
  34. package/esm/internals/getScale.js +17 -0
  35. package/esm/internals/isBandScale.js +3 -0
  36. package/esm/models/axis.js +6 -1
  37. package/hooks/index.d.ts +2 -0
  38. package/hooks/index.js +27 -0
  39. package/hooks/package.json +6 -0
  40. package/hooks/useAxisEvents.js +14 -9
  41. package/hooks/useDrawingArea.d.ts +6 -0
  42. package/hooks/useDrawingArea.js +24 -0
  43. package/hooks/useScale.d.ts +3 -6
  44. package/hooks/useScale.js +24 -24
  45. package/hooks/useTicks.d.ts +1 -1
  46. package/hooks/useTicks.js +19 -9
  47. package/index.d.ts +1 -0
  48. package/index.js +12 -1
  49. package/internals/getScale.d.ts +2 -0
  50. package/internals/getScale.js +23 -0
  51. package/internals/isBandScale.d.ts +3 -0
  52. package/internals/isBandScale.js +9 -0
  53. package/legacy/BarChart/BarChart.js +3 -2
  54. package/legacy/BarChart/BarPlot.js +44 -10
  55. package/legacy/ChartContainer/index.js +7 -5
  56. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
  57. package/legacy/LineChart/LineChart.js +3 -2
  58. package/legacy/LineChart/extremums.js +3 -3
  59. package/legacy/ResponsiveChartContainer/index.js +11 -10
  60. package/legacy/ScatterChart/ScatterChart.js +3 -2
  61. package/legacy/context/CartesianContextProvider.js +31 -18
  62. package/legacy/context/SeriesContextProvider.js +2 -2
  63. package/legacy/hooks/index.js +2 -0
  64. package/legacy/hooks/useAxisEvents.js +12 -7
  65. package/legacy/hooks/useDrawingArea.js +17 -0
  66. package/legacy/hooks/useScale.js +17 -21
  67. package/legacy/hooks/useTicks.js +26 -13
  68. package/legacy/index.js +2 -1
  69. package/legacy/internals/getScale.js +17 -0
  70. package/legacy/internals/isBandScale.js +3 -0
  71. package/legacy/models/axis.js +6 -1
  72. package/models/axis.d.ts +25 -12
  73. package/models/axis.js +9 -1
  74. package/models/seriesType/pie.d.ts +2 -2
  75. package/modern/BarChart/BarChart.js +3 -2
  76. package/modern/BarChart/BarPlot.js +44 -8
  77. package/modern/ChartContainer/index.js +7 -5
  78. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
  79. package/modern/LineChart/LineChart.js +3 -2
  80. package/modern/LineChart/extremums.js +2 -2
  81. package/modern/ResponsiveChartContainer/index.js +11 -10
  82. package/modern/ScatterChart/ScatterChart.js +3 -2
  83. package/modern/context/CartesianContextProvider.js +29 -18
  84. package/modern/context/SeriesContextProvider.js +2 -2
  85. package/modern/hooks/index.js +2 -0
  86. package/modern/hooks/useAxisEvents.js +12 -7
  87. package/modern/hooks/useDrawingArea.js +16 -0
  88. package/modern/hooks/useScale.js +19 -21
  89. package/modern/hooks/useTicks.js +18 -8
  90. package/modern/index.js +2 -1
  91. package/modern/internals/getScale.js +17 -0
  92. package/modern/internals/isBandScale.js +3 -0
  93. package/modern/models/axis.js +6 -1
  94. package/package.json +22 -5
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v6.0.0-alpha.2
2
+ * @mui/x-charts v6.0.0-alpha.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -7,6 +7,7 @@
7
7
  */
8
8
  export * from './constants';
9
9
  export * from './context';
10
+ export * from './hooks';
10
11
  export * from './colorPalettes';
11
12
  export * from './models';
12
13
  export * from './ChartsClipPath';
@@ -0,0 +1,17 @@
1
+ import { scaleLog, scalePow, scaleSqrt, scaleTime, scaleUtc, scaleLinear } from 'd3-scale';
2
+ export function getScale(scaleType, domain, range) {
3
+ switch (scaleType) {
4
+ case 'log':
5
+ return scaleLog(domain, range);
6
+ case 'pow':
7
+ return scalePow(domain, range);
8
+ case 'sqrt':
9
+ return scaleSqrt(domain, range);
10
+ case 'time':
11
+ return scaleTime(domain, range);
12
+ case 'utc':
13
+ return scaleUtc(domain, range);
14
+ default:
15
+ return scaleLinear(domain, range);
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ export function isBandScale(scale) {
2
+ return scale.bandwidth !== undefined;
3
+ }
@@ -1 +1,6 @@
1
- export {};
1
+ export function isBandScaleConfig(scaleConfig) {
2
+ return scaleConfig.scaleType === 'band';
3
+ }
4
+ export function isPointScaleConfig(scaleConfig) {
5
+ return scaleConfig.scaleType === 'point';
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.0-alpha.4",
4
4
  "description": "The community edition of the charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -27,10 +27,7 @@
27
27
  "directory": "packages/x-charts"
28
28
  },
29
29
  "dependencies": {
30
- "@babel/runtime": "^7.22.5",
31
- "@types/d3-color": "^3.1.0",
32
- "@types/d3-scale": "^4.0.3",
33
- "@types/d3-shape": "^3.1.1",
30
+ "@babel/runtime": "^7.22.6",
34
31
  "clsx": "^1.2.1",
35
32
  "d3-color": "^3.1.0",
36
33
  "d3-scale": "^4.0.2",
@@ -38,11 +35,31 @@
38
35
  "prop-types": "^15.8.1"
39
36
  },
40
37
  "peerDependencies": {
38
+ "@emotion/react": "^11.9.0",
39
+ "@emotion/styled": "^11.8.1",
41
40
  "@mui/material": "^5.4.1",
42
41
  "@mui/system": "^5.4.1",
43
42
  "react": "^17.0.0 || ^18.0.0",
44
43
  "react-dom": "^17.0.0 || ^18.0.0"
45
44
  },
45
+ "peerDependenciesMeta": {
46
+ "@emotion/react": {
47
+ "optional": true
48
+ },
49
+ "@emotion/styled": {
50
+ "optional": true
51
+ }
52
+ },
53
+ "exports": {
54
+ ".": {
55
+ "require": "./index.js",
56
+ "import": "./esm/index.js"
57
+ },
58
+ "./*": {
59
+ "require": "./*",
60
+ "import": "./esm/*"
61
+ }
62
+ },
46
63
  "setupFiles": [
47
64
  "<rootDir>/src/setupTests.js"
48
65
  ],