@mui/x-charts 6.19.3 → 6.19.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 (127) hide show
  1. package/BarChart/BarChart.js +11 -9
  2. package/BarChart/BarElement.d.ts +6 -3
  3. package/BarChart/BarElement.js +1 -0
  4. package/BarChart/BarPlot.js +9 -10
  5. package/CHANGELOG.md +56 -0
  6. package/ChartsAxis/ChartsAxis.js +4 -4
  7. package/ChartsLegend/ChartsLegend.js +0 -101
  8. package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  9. package/ChartsReferenceLine/common.d.ts +2 -1
  10. package/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
  11. package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
  12. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  13. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
  14. package/ChartsXAxis/ChartsXAxis.js +13 -9
  15. package/ChartsYAxis/ChartsYAxis.js +1 -1
  16. package/LineChart/AreaElement.d.ts +7 -4
  17. package/LineChart/AreaElement.js +1 -0
  18. package/LineChart/LineChart.js +11 -9
  19. package/LineChart/LineElement.d.ts +7 -4
  20. package/LineChart/LineElement.js +1 -0
  21. package/LineChart/LineHighlightElement.d.ts +3 -2
  22. package/LineChart/LineHighlightElement.js +2 -1
  23. package/LineChart/MarkElement.d.ts +3 -2
  24. package/LineChart/MarkElement.js +1 -0
  25. package/PieChart/PieArc.d.ts +3 -2
  26. package/PieChart/PieArc.js +1 -0
  27. package/PieChart/PieArcLabel.d.ts +3 -2
  28. package/PieChart/PieArcLabel.js +1 -0
  29. package/PieChart/PieArcLabelPlot.js +1 -1
  30. package/PieChart/PieArcPlot.js +1 -1
  31. package/PieChart/PieChart.js +11 -9
  32. package/ScatterChart/Scatter.js +1 -1
  33. package/ScatterChart/ScatterChart.js +11 -9
  34. package/SparkLineChart/SparkLineChart.js +3 -2
  35. package/context/CartesianContextProvider.js +8 -6
  36. package/context/InteractionProvider.d.ts +2 -2
  37. package/esm/BarChart/BarChart.js +11 -9
  38. package/esm/BarChart/BarElement.js +1 -0
  39. package/esm/BarChart/BarPlot.js +8 -10
  40. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  41. package/esm/ChartsLegend/ChartsLegend.js +0 -101
  42. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  43. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
  44. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
  45. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  46. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
  47. package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
  48. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  49. package/esm/LineChart/AreaElement.js +1 -0
  50. package/esm/LineChart/LineChart.js +11 -9
  51. package/esm/LineChart/LineElement.js +1 -0
  52. package/esm/LineChart/LineHighlightElement.js +2 -1
  53. package/esm/LineChart/MarkElement.js +1 -0
  54. package/esm/PieChart/PieArc.js +1 -0
  55. package/esm/PieChart/PieArcLabel.js +1 -0
  56. package/esm/PieChart/PieArcLabelPlot.js +1 -1
  57. package/esm/PieChart/PieArcPlot.js +1 -1
  58. package/esm/PieChart/PieChart.js +11 -9
  59. package/esm/ScatterChart/Scatter.js +1 -1
  60. package/esm/ScatterChart/ScatterChart.js +11 -9
  61. package/esm/SparkLineChart/SparkLineChart.js +3 -2
  62. package/esm/context/CartesianContextProvider.js +8 -6
  63. package/index.js +1 -1
  64. package/internals/defaultizeColor.d.ts +15 -15
  65. package/internals/defaultizeValueFormatter.d.ts +4 -7
  66. package/internals/stackSeries.d.ts +4 -7
  67. package/legacy/BarChart/BarChart.js +11 -9
  68. package/legacy/BarChart/BarElement.js +1 -0
  69. package/legacy/BarChart/BarPlot.js +10 -10
  70. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  71. package/legacy/ChartsLegend/ChartsLegend.js +0 -101
  72. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  73. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
  74. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
  75. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  76. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
  77. package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
  78. package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
  79. package/legacy/LineChart/AreaElement.js +1 -0
  80. package/legacy/LineChart/LineChart.js +11 -9
  81. package/legacy/LineChart/LineElement.js +1 -0
  82. package/legacy/LineChart/LineHighlightElement.js +2 -1
  83. package/legacy/LineChart/MarkElement.js +1 -0
  84. package/legacy/PieChart/PieArc.js +1 -0
  85. package/legacy/PieChart/PieArcLabel.js +1 -0
  86. package/legacy/PieChart/PieArcLabelPlot.js +1 -1
  87. package/legacy/PieChart/PieArcPlot.js +1 -1
  88. package/legacy/PieChart/PieChart.js +11 -9
  89. package/legacy/ScatterChart/Scatter.js +1 -1
  90. package/legacy/ScatterChart/ScatterChart.js +11 -9
  91. package/legacy/SparkLineChart/SparkLineChart.js +3 -2
  92. package/legacy/context/CartesianContextProvider.js +8 -6
  93. package/legacy/index.js +1 -1
  94. package/models/axis.d.ts +7 -2
  95. package/models/seriesType/common.d.ts +2 -1
  96. package/models/seriesType/config.d.ts +7 -12
  97. package/models/seriesType/line.d.ts +2 -2
  98. package/models/seriesType/pie.d.ts +7 -3
  99. package/models/seriesType/scatter.d.ts +5 -2
  100. package/modern/BarChart/BarChart.js +11 -9
  101. package/modern/BarChart/BarElement.js +1 -0
  102. package/modern/BarChart/BarPlot.js +8 -10
  103. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  104. package/modern/ChartsLegend/ChartsLegend.js +0 -101
  105. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  106. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
  107. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
  108. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  109. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
  110. package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
  111. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  112. package/modern/LineChart/AreaElement.js +1 -0
  113. package/modern/LineChart/LineChart.js +11 -9
  114. package/modern/LineChart/LineElement.js +1 -0
  115. package/modern/LineChart/LineHighlightElement.js +2 -1
  116. package/modern/LineChart/MarkElement.js +1 -0
  117. package/modern/PieChart/PieArc.js +1 -0
  118. package/modern/PieChart/PieArcLabel.js +1 -0
  119. package/modern/PieChart/PieArcLabelPlot.js +1 -1
  120. package/modern/PieChart/PieArcPlot.js +1 -1
  121. package/modern/PieChart/PieChart.js +11 -9
  122. package/modern/ScatterChart/Scatter.js +1 -1
  123. package/modern/ScatterChart/ScatterChart.js +11 -9
  124. package/modern/SparkLineChart/SparkLineChart.js +3 -2
  125. package/modern/context/CartesianContextProvider.js +8 -6
  126. package/modern/index.js +1 -1
  127. package/package.json +1 -1
@@ -136,7 +136,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
136
136
  * @default xAxisIds[0] The id of the first provided axis
137
137
  */
138
138
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
139
- axisId: _propTypes.default.string,
139
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
140
140
  classes: _propTypes.default.object,
141
141
  disableLine: _propTypes.default.bool,
142
142
  disableTicks: _propTypes.default.bool,
@@ -187,7 +187,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
187
187
  * @default yAxisIds[0] The id of the first provided axis
188
188
  */
189
189
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
190
- axisId: _propTypes.default.string,
190
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
191
191
  classes: _propTypes.default.object,
192
192
  disableLine: _propTypes.default.bool,
193
193
  disableTicks: _propTypes.default.bool,
@@ -240,7 +240,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
240
240
  * @default null
241
241
  */
242
242
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
243
- axisId: _propTypes.default.string,
243
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
244
244
  classes: _propTypes.default.object,
245
245
  disableLine: _propTypes.default.bool,
246
246
  disableTicks: _propTypes.default.bool,
@@ -269,7 +269,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
269
269
  faded: _propTypes.default.oneOf(['global', 'none', 'series']),
270
270
  highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
271
271
  }),
272
- id: _propTypes.default.string,
272
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
273
273
  label: _propTypes.default.string,
274
274
  layout: _propTypes.default.oneOf(['horizontal', 'vertical']),
275
275
  stack: _propTypes.default.string,
@@ -311,7 +311,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
311
311
  * @default null
312
312
  */
313
313
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
314
- axisId: _propTypes.default.string,
314
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
315
315
  classes: _propTypes.default.object,
316
316
  disableLine: _propTypes.default.bool,
317
317
  disableTicks: _propTypes.default.bool,
@@ -348,7 +348,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
348
348
  * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
349
349
  */
350
350
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
351
- axisId: _propTypes.default.string,
351
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
352
352
  classes: _propTypes.default.object,
353
353
  data: _propTypes.default.array,
354
354
  dataKey: _propTypes.default.string,
@@ -356,13 +356,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
356
356
  disableTicks: _propTypes.default.bool,
357
357
  fill: _propTypes.default.string,
358
358
  hideTooltip: _propTypes.default.bool,
359
- id: _propTypes.default.string,
359
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
360
360
  label: _propTypes.default.string,
361
361
  labelFontSize: _propTypes.default.number,
362
362
  labelStyle: _propTypes.default.object,
363
363
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
364
364
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
365
365
  position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
366
+ reverse: _propTypes.default.bool,
366
367
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
367
368
  slotProps: _propTypes.default.object,
368
369
  slots: _propTypes.default.object,
@@ -382,7 +383,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
382
383
  * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
383
384
  */
384
385
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
385
- axisId: _propTypes.default.string,
386
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
386
387
  classes: _propTypes.default.object,
387
388
  data: _propTypes.default.array,
388
389
  dataKey: _propTypes.default.string,
@@ -390,13 +391,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
390
391
  disableTicks: _propTypes.default.bool,
391
392
  fill: _propTypes.default.string,
392
393
  hideTooltip: _propTypes.default.bool,
393
- id: _propTypes.default.string,
394
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
394
395
  label: _propTypes.default.string,
395
396
  labelFontSize: _propTypes.default.number,
396
397
  labelStyle: _propTypes.default.object,
397
398
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
398
399
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
399
400
  position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
401
+ reverse: _propTypes.default.bool,
400
402
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
401
403
  slotProps: _propTypes.default.object,
402
404
  slots: _propTypes.default.object,
@@ -1,13 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import { HighlightScope } from '../context/HighlightProvider';
4
+ import { SeriesId } from '../models/seriesType/common';
4
5
  export interface BarElementClasses {
5
6
  /** Styles applied to the root element. */
6
7
  root: string;
7
8
  }
8
9
  export type BarElementClassKey = keyof BarElementClasses;
9
10
  export interface BarElementOwnerState {
10
- id: string;
11
+ id: SeriesId;
11
12
  dataIndex: number;
12
13
  color: string;
13
14
  isFaded: boolean;
@@ -1351,14 +1352,16 @@ export declare const BarElementPath: import("@emotion/styled").StyledComponent<P
1351
1352
  }, "string" | "end" | "accumulate" | "local" | "color" | "clip" | "style" | "unicode" | "fill" | "stroke" | "x" | "y" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "path" | "ref" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "target" | "type" | "suppressHydrationWarning" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accentHeight" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "scrollTop" | "scrollLeft"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
1352
1353
  ownerState: BarElementOwnerState;
1353
1354
  }, {}, {}>;
1354
- export type BarElementProps = Omit<BarElementOwnerState, 'isFaded' | 'isHighlighted'> & React.ComponentPropsWithoutRef<'path'> & {
1355
+ export type BarElementProps = Omit<BarElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.ComponentPropsWithoutRef<'path'>, 'id'> & {
1355
1356
  highlightScope?: Partial<HighlightScope>;
1356
1357
  /**
1357
1358
  * The props used for each component slot.
1358
1359
  * @default {}
1359
1360
  */
1360
1361
  slotProps?: {
1361
- bar?: SlotComponentProps<'path', {}, BarElementOwnerState>;
1362
+ bar?: Omit<SlotComponentProps<'path', {}, BarElementOwnerState>, 'id'> & {
1363
+ id?: SeriesId;
1364
+ };
1362
1365
  };
1363
1366
  /**
1364
1367
  * Overridable component slots.
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
113
113
  faded: _propTypes.default.oneOf(['global', 'none', 'series']),
114
114
  highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
115
115
  }),
116
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
116
117
  /**
117
118
  * The props used for each component slot.
118
119
  * @default {}
@@ -17,6 +17,8 @@ var _axis = require("../models/axis");
17
17
  var _constants = require("../constants");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  const _excluded = ["skipAnimation"];
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
22
  /**
21
23
  * Solution of the equations
22
24
  * W = barWidth * N + offset * (N-1)
@@ -26,8 +28,6 @@ const _excluded = ["skipAnimation"];
26
28
  * @param gapRatio The ratio of the gap between bars over the bar width.
27
29
  * @returns The bar width and the offset between bars.
28
30
  */
29
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
30
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
31
31
  function getBandSize({
32
32
  bandWidth: W,
33
33
  numberOfGroups: N,
@@ -109,20 +109,19 @@ const useCompletedData = () => {
109
109
  color
110
110
  } = series[seriesId];
111
111
  return stackedData.map((values, dataIndex) => {
112
- const bottom = Math.min(...values);
113
- const top = Math.max(...values);
112
+ const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
113
+ const minValueCoord = Math.min(...valueCoordinates);
114
+ const maxValueCoord = Math.max(...valueCoordinates);
114
115
  return {
115
- bottom,
116
- top,
117
116
  seriesId,
118
117
  dataIndex,
119
118
  layout: series[seriesId].layout,
120
- x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset : xScale(bottom),
121
- y: verticalLayout ? yScale(top) : yScale(yAxis[yAxisKey].data?.[dataIndex]) + barOffset,
119
+ x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset : minValueCoord,
120
+ y: verticalLayout ? minValueCoord : yScale(yAxis[yAxisKey].data?.[dataIndex]) + barOffset,
122
121
  xOrigin: xScale(0),
123
122
  yOrigin: yScale(0),
124
- height: verticalLayout ? Math.abs(yScale(bottom) - yScale(top)) : barWidth,
125
- width: verticalLayout ? barWidth : Math.abs(xScale(bottom) - xScale(top)),
123
+ height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
124
+ width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
126
125
  color,
127
126
  highlightScope: series[seriesId].highlightScope
128
127
  };
package/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## v6.19.4
7
+
8
+ _Feb 9, 2024_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🌍 Improve Danish (da-DK) locale on the Data Grid (#11972) @ShahrazH
13
+ - 🐞 Bugfixes
14
+ - 📚 Documentation improvements
15
+
16
+ ### Data Grid
17
+
18
+ #### `@mui/x-data-grid@v6.19.4`
19
+
20
+ - [DataGrid] Add support for dialogs in menu actions (#11937) @cherniavskii
21
+ - [DataGrid] Allow passing readonly arrays to `pageSizeOptions` prop (#11992) @pcorpet
22
+ - [DataGrid] Fix row reorder with cell selection (#11878) @PEsteves8
23
+ - [DataGrid] Replace `eval` with `new Function` (#11962) @cherniavskii
24
+ - [l10n] Improve Danish (da-DK) locale (#11972) @ShahrazH
25
+
26
+ #### `@mui/x-data-grid-pro@v6.19.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
27
+
28
+ Same changes as in `@mui/x-data-grid@v6.19.4`.
29
+
30
+ #### `@mui/x-data-grid-premium@v6.19.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
31
+
32
+ Same changes as in `@mui/x-data-grid-pro@v6.19.4`, plus:
33
+
34
+ - [DataGridPremium] Fix autosize grouping cell (#11990) @romgrk
35
+ - [DataGridPremium] Fix error after closing print export (#11889) @cherniavskii
36
+
37
+ ### Date Pickers
38
+
39
+ #### `@mui/x-date-pickers@v6.19.4`
40
+
41
+ - [pickers] Avoid relying on locale in Luxon `isWithinRange` method (#11940) @LukasTy
42
+
43
+ #### `@mui/x-date-pickers-pro@v6.19.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
44
+
45
+ Same changes as in `@mui/x-date-pickers@v6.19.4`.
46
+
47
+ ### Charts / `@mui/x-charts@v6.19.4`
48
+
49
+ - [charts] Add `reverse` property to axes (#11959) @alexfauquette
50
+ - [charts] Allow series ids to be numbers (#11960) @alexfauquette
51
+ - [charts] Fix Proptypes error by supporting string values for axes (#11953) @alexfauquette
52
+
53
+ ### Docs
54
+
55
+ - [docs] Add a note about `AdapterDateFnsV3` on the Getting Started page (#11987) @flaviendelangle
56
+ - [docs] Avoid the use of MUI Core @oliviertassinari
57
+ - [docs] Fix API links (#11930) @alexfauquette
58
+ - [docs] Fix `ChartsTooltip` typo (#11967) @thisisharsh7
59
+ - [docs] Refactor `Localization` documentation sections (#11997) @LukasTy
60
+ - [code] Simplify bug reproduction (#11932) @alexfauquette
61
+
6
62
  ## 6.19.3
7
63
 
8
64
  _Feb 1, 2024_
@@ -108,7 +108,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
108
108
  * @default xAxisIds[0] The id of the first provided axis
109
109
  */
110
110
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
111
- axisId: _propTypes.default.string,
111
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
112
112
  classes: _propTypes.default.object,
113
113
  disableLine: _propTypes.default.bool,
114
114
  disableTicks: _propTypes.default.bool,
@@ -135,7 +135,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
135
135
  * @default yAxisIds[0] The id of the first provided axis
136
136
  */
137
137
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
138
- axisId: _propTypes.default.string,
138
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
139
139
  classes: _propTypes.default.object,
140
140
  disableLine: _propTypes.default.bool,
141
141
  disableTicks: _propTypes.default.bool,
@@ -162,7 +162,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
162
162
  * @default null
163
163
  */
164
164
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
165
- axisId: _propTypes.default.string,
165
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
166
166
  classes: _propTypes.default.object,
167
167
  disableLine: _propTypes.default.bool,
168
168
  disableTicks: _propTypes.default.bool,
@@ -199,7 +199,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
199
199
  * @default null
200
200
  */
201
201
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
202
- axisId: _propTypes.default.string,
202
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
203
203
  classes: _propTypes.default.object,
204
204
  disableLine: _propTypes.default.bool,
205
205
  disableTicks: _propTypes.default.bool,
@@ -244,107 +244,6 @@ function DefaultChartsLegend(props) {
244
244
  })
245
245
  });
246
246
  }
247
- process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
248
- // ----------------------------- Warning --------------------------------
249
- // | These PropTypes are generated from the TypeScript type definitions |
250
- // | To update them edit the TypeScript types and run "yarn proptypes" |
251
- // ----------------------------------------------------------------------
252
- /**
253
- * Override or extend the styles applied to the component.
254
- */
255
- classes: _propTypes.default.object.isRequired,
256
- /**
257
- * The direction of the legend layout.
258
- * The default depends on the chart.
259
- */
260
- direction: _propTypes.default.oneOf(['column', 'row']).isRequired,
261
- drawingArea: _propTypes.default.shape({
262
- bottom: _propTypes.default.number.isRequired,
263
- height: _propTypes.default.number.isRequired,
264
- left: _propTypes.default.number.isRequired,
265
- right: _propTypes.default.number.isRequired,
266
- top: _propTypes.default.number.isRequired,
267
- width: _propTypes.default.number.isRequired
268
- }).isRequired,
269
- /**
270
- * Set to true to hide the legend.
271
- * @default false
272
- */
273
- hidden: _propTypes.default.bool,
274
- /**
275
- * Space between two legend items (in px).
276
- * @default 10
277
- */
278
- itemGap: _propTypes.default.number,
279
- /**
280
- * Height of the item mark (in px).
281
- * @default 20
282
- */
283
- itemMarkHeight: _propTypes.default.number,
284
- /**
285
- * Width of the item mark (in px).
286
- * @default 20
287
- */
288
- itemMarkWidth: _propTypes.default.number,
289
- /**
290
- * Style applied to legend labels.
291
- * @default theme.typography.subtitle1
292
- */
293
- labelStyle: _propTypes.default.object,
294
- /**
295
- * Space between the mark and the label (in px).
296
- * @default 5
297
- */
298
- markGap: _propTypes.default.number,
299
- /**
300
- * Legend padding (in px).
301
- * Can either be a single number, or an object with top, left, bottom, right properties.
302
- * @default 0
303
- */
304
- padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
305
- bottom: _propTypes.default.number,
306
- left: _propTypes.default.number,
307
- right: _propTypes.default.number,
308
- top: _propTypes.default.number
309
- })]),
310
- position: _propTypes.default.shape({
311
- horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
312
- vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
313
- }).isRequired,
314
- series: _propTypes.default.shape({
315
- bar: _propTypes.default.shape({
316
- series: _propTypes.default.object.isRequired,
317
- seriesOrder: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
318
- stackingGroups: _propTypes.default.arrayOf(_propTypes.default.shape({
319
- ids: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
320
- stackingOffset: _propTypes.default.func.isRequired,
321
- stackingOrder: _propTypes.default.func.isRequired
322
- })).isRequired
323
- }),
324
- line: _propTypes.default.shape({
325
- series: _propTypes.default.object.isRequired,
326
- seriesOrder: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
327
- stackingGroups: _propTypes.default.arrayOf(_propTypes.default.shape({
328
- ids: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
329
- stackingOffset: _propTypes.default.func.isRequired,
330
- stackingOrder: _propTypes.default.func.isRequired
331
- })).isRequired
332
- }),
333
- pie: _propTypes.default.shape({
334
- series: _propTypes.default.object.isRequired,
335
- seriesOrder: _propTypes.default.arrayOf(_propTypes.default.string).isRequired
336
- }),
337
- scatter: _propTypes.default.shape({
338
- series: _propTypes.default.object.isRequired,
339
- seriesOrder: _propTypes.default.arrayOf(_propTypes.default.string).isRequired
340
- })
341
- }).isRequired,
342
- seriesToDisplay: _propTypes.default.arrayOf(_propTypes.default.shape({
343
- color: _propTypes.default.string.isRequired,
344
- id: _propTypes.default.string.isRequired,
345
- label: _propTypes.default.string.isRequired
346
- })).isRequired
347
- } : void 0;
348
247
  function ChartsLegend(inProps) {
349
248
  const props = (0, _styles.useThemeProps)({
350
249
  props: (0, _extends2.default)({}, defaultProps, inProps),
@@ -38,7 +38,7 @@ process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
38
38
  * The id of the axis used for the reference value.
39
39
  * @default The `id` of the first defined axis.
40
40
  */
41
- axisId: _propTypes.default.string,
41
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
42
42
  /**
43
43
  * Override or extend the styles applied to the component.
44
44
  */
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ChartsReferenceLineClasses } from './chartsReferenceLineClasses';
3
3
  import { ChartsTextStyle } from '../ChartsText';
4
+ import { AxisId } from '../models/axis';
4
5
  export type CommonChartsReferenceLineProps = {
5
6
  /**
6
7
  * The alignment if the label is in the chart drawing area.
@@ -24,7 +25,7 @@ export type CommonChartsReferenceLineProps = {
24
25
  * The id of the axis used for the reference value.
25
26
  * @default The `id` of the first defined axis.
26
27
  */
27
- axisId?: string;
28
+ axisId?: AxisId;
28
29
  /**
29
30
  * The style applied to the label.
30
31
  */
@@ -75,11 +75,11 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
75
75
  axisData: _propTypes.default.shape({
76
76
  x: _propTypes.default.shape({
77
77
  index: _propTypes.default.number,
78
- value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired
78
+ value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
79
79
  }),
80
80
  y: _propTypes.default.shape({
81
81
  index: _propTypes.default.number,
82
- value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired
82
+ value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
83
83
  })
84
84
  }).isRequired,
85
85
  classes: _propTypes.default.object.isRequired,
@@ -89,11 +89,11 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
89
89
  axisData: _propTypes.default.shape({
90
90
  x: _propTypes.default.shape({
91
91
  index: _propTypes.default.number,
92
- value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired
92
+ value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
93
93
  }),
94
94
  y: _propTypes.default.shape({
95
95
  index: _propTypes.default.number,
96
- value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired
96
+ value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
97
97
  })
98
98
  }),
99
99
  axisValue: _propTypes.default.any,
@@ -48,7 +48,7 @@ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
48
48
  classes: _propTypes.default.object,
49
49
  itemData: _propTypes.default.shape({
50
50
  dataIndex: _propTypes.default.number,
51
- seriesId: _propTypes.default.string.isRequired,
51
+ seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
52
52
  type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
53
53
  }),
54
54
  series: _propTypes.default.shape({
@@ -72,7 +72,7 @@ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
72
72
  faded: _propTypes.default.oneOf(['global', 'none', 'series']),
73
73
  highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
74
74
  }),
75
- id: _propTypes.default.string.isRequired,
75
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
76
76
  type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired,
77
77
  valueFormatter: _propTypes.default.func.isRequired
78
78
  }),
@@ -80,7 +80,7 @@ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
80
80
  }),
81
81
  itemData: _propTypes.default.shape({
82
82
  dataIndex: _propTypes.default.number,
83
- seriesId: _propTypes.default.string.isRequired,
83
+ seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
84
84
  type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
85
85
  }).isRequired,
86
86
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
@@ -95,11 +95,11 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
95
95
  axisData: _propTypes.default.shape({
96
96
  x: _propTypes.default.shape({
97
97
  index: _propTypes.default.number,
98
- value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired
98
+ value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
99
99
  }),
100
100
  y: _propTypes.default.shape({
101
101
  index: _propTypes.default.number,
102
- value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired
102
+ value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
103
103
  })
104
104
  }).isRequired,
105
105
  /**
@@ -78,7 +78,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propType
78
78
  */
79
79
  itemData: _propTypes.default.shape({
80
80
  dataIndex: _propTypes.default.number,
81
- seriesId: _propTypes.default.string.isRequired,
81
+ seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
82
82
  type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
83
83
  }).isRequired,
84
84
  /**
@@ -105,7 +105,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propType
105
105
  faded: _propTypes.default.oneOf(['global', 'none', 'series']),
106
106
  highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
107
107
  }),
108
- id: _propTypes.default.string.isRequired,
108
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
109
109
  type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired,
110
110
  valueFormatter: _propTypes.default.func.isRequired
111
111
  }).isRequired,
@@ -22,7 +22,7 @@ var _geometry = require("../internals/geometry");
22
22
  var _useMounted = require("../hooks/useMounted");
23
23
  var _getWordsByLines = require("../internals/getWordsByLines");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
- const _excluded = ["scale", "tickNumber"];
25
+ const _excluded = ["scale", "tickNumber", "reverse"];
26
26
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
27
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
28
  const useUtilityClasses = ownerState => {
@@ -43,6 +43,7 @@ const useUtilityClasses = ownerState => {
43
43
  function addLabelDimension(xTicks, {
44
44
  tickLabelStyle: style,
45
45
  tickLabelInterval,
46
+ reverse,
46
47
  isMounted
47
48
  }) {
48
49
  const withDimension = xTicks.map(tick => {
@@ -69,8 +70,9 @@ function addLabelDimension(xTicks, {
69
70
  }
70
71
 
71
72
  // Filter label to avoid overlap
72
- let textStart = 0;
73
- let textEnd = 0;
73
+ let currentTextLimit = 0;
74
+ let previouseTextLimit = 0;
75
+ const direction = reverse ? -1 : 1;
74
76
  return withDimension.map((item, labelIndex) => {
75
77
  const {
76
78
  width,
@@ -82,15 +84,15 @@ function addLabelDimension(xTicks, {
82
84
  const textPosition = offset + labelOffset;
83
85
  const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
84
86
 
85
- textStart = textPosition - gapRatio * distance / 2;
86
- if (labelIndex > 0 && textStart < textEnd) {
87
+ currentTextLimit = textPosition - direction * (gapRatio * distance) / 2;
88
+ if (labelIndex > 0 && direction * currentTextLimit < direction * previouseTextLimit) {
87
89
  // Except for the first label, we skip all label that overlap with the last accepted.
88
- // Notice that the early return prevents `textEnd` from being updated.
90
+ // Notice that the early return prevents `previouseTextLimit` from being updated.
89
91
  return (0, _extends2.default)({}, item, {
90
92
  skipLabel: true
91
93
  });
92
94
  }
93
- textEnd = textPosition + gapRatio * distance / 2;
95
+ previouseTextLimit = textPosition + direction * (gapRatio * distance) / 2;
94
96
  return item;
95
97
  });
96
98
  }
@@ -124,7 +126,8 @@ function ChartsXAxis(inProps) {
124
126
  xAxis: {
125
127
  [_ref]: {
126
128
  scale: xScale,
127
- tickNumber
129
+ tickNumber,
130
+ reverse
128
131
  }
129
132
  }
130
133
  } = _React$useContext,
@@ -186,6 +189,7 @@ function ChartsXAxis(inProps) {
186
189
  const xTicksWithDimension = addLabelDimension(xTicks, {
187
190
  tickLabelStyle: axisTickLabelProps.style,
188
191
  tickLabelInterval,
192
+ reverse,
189
193
  isMounted
190
194
  });
191
195
  const labelRefPoint = {
@@ -249,7 +253,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
249
253
  * The id of the axis to render.
250
254
  * If undefined, it will be the first defined axis.
251
255
  */
252
- axisId: _propTypes.default.string,
256
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
253
257
  /**
254
258
  * Override or extend the styles applied to the component.
255
259
  */
@@ -183,7 +183,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
183
183
  * The id of the axis to render.
184
184
  * If undefined, it will be the first defined axis.
185
185
  */
186
- axisId: _propTypes.default.string,
186
+ axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
187
187
  /**
188
188
  * Override or extend the styles applied to the component.
189
189
  */