@mui/x-charts 8.10.0 → 8.10.2
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.
- package/BarChart/BarChart.js +4 -0
- package/CHANGELOG.md +182 -0
- package/ChartContainer/ChartContainer.js +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +8 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +1 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/ChartsXAxis/ChartsGroupedXAxis.js +1 -0
- package/ChartsXAxis/useAxisProps.d.ts +9 -9
- package/ChartsXAxis/utilities.d.ts +1 -1
- package/ChartsYAxis/ChartsGroupedYAxis.d.ts +7 -0
- package/ChartsYAxis/ChartsGroupedYAxis.js +144 -0
- package/ChartsYAxis/ChartsSingleYAxis.d.ts +7 -0
- package/ChartsYAxis/ChartsSingleYAxis.js +133 -0
- package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
- package/ChartsYAxis/ChartsYAxis.js +12 -211
- package/ChartsYAxis/useAxisProps.d.ts +4452 -0
- package/ChartsYAxis/useAxisProps.js +115 -0
- package/ChartsYAxis/utilities.d.ts +10 -0
- package/ChartsYAxis/utilities.js +42 -0
- package/LineChart/LineChart.js +4 -0
- package/ScatterChart/ScatterChart.js +4 -0
- package/SparkLineChart/SparkLineChart.d.ts +15 -5
- package/SparkLineChart/SparkLineChart.js +61 -34
- package/esm/BarChart/BarChart.js +4 -0
- package/esm/ChartContainer/ChartContainer.js +6 -0
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/esm/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/esm/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +8 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +1 -0
- package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/esm/ChartsXAxis/ChartsGroupedXAxis.js +1 -0
- package/esm/ChartsXAxis/useAxisProps.d.ts +9 -9
- package/esm/ChartsXAxis/utilities.d.ts +1 -1
- package/esm/ChartsYAxis/ChartsGroupedYAxis.d.ts +7 -0
- package/esm/ChartsYAxis/ChartsGroupedYAxis.js +138 -0
- package/esm/ChartsYAxis/ChartsSingleYAxis.d.ts +7 -0
- package/esm/ChartsYAxis/ChartsSingleYAxis.js +129 -0
- package/esm/ChartsYAxis/ChartsYAxis.d.ts +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +10 -207
- package/esm/ChartsYAxis/useAxisProps.d.ts +4452 -0
- package/esm/ChartsYAxis/useAxisProps.js +108 -0
- package/esm/ChartsYAxis/utilities.d.ts +10 -0
- package/esm/ChartsYAxis/utilities.js +34 -0
- package/esm/LineChart/LineChart.js +4 -0
- package/esm/ScatterChart/ScatterChart.js +4 -0
- package/esm/SparkLineChart/SparkLineChart.d.ts +15 -5
- package/esm/SparkLineChart/SparkLineChart.js +61 -34
- package/esm/index.js +1 -1
- package/esm/internals/animation/Transition.js +2 -5
- package/esm/internals/configInit.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +2 -2
- package/esm/internals/plugins/utils/ChartStore.js +16 -18
- package/esm/models/axis.d.ts +31 -48
- package/esm/tests/web-components.js +2 -4
- package/index.js +1 -1
- package/internals/animation/Transition.js +2 -5
- package/internals/configInit.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +2 -2
- package/internals/plugins/utils/ChartStore.js +16 -18
- package/models/axis.d.ts +31 -48
- package/package.json +16 -17
- package/tests/web-components.js +2 -4
|
@@ -13,6 +13,6 @@ export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent
|
|
|
13
13
|
/**
|
|
14
14
|
* @ignore - internal component.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "
|
|
16
|
+
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "color" | "className" | "sx" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "children" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "color" | "className" | "sx" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "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" | "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" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
17
17
|
component?: React.ElementType;
|
|
18
18
|
}, {}, {}>;
|
|
@@ -78,6 +78,7 @@ export const ChartsTooltipCell = styled(Typography, {
|
|
|
78
78
|
paddingRight: theme.spacing(1)
|
|
79
79
|
},
|
|
80
80
|
[`&.${chartsTooltipClasses.labelCell}`]: {
|
|
81
|
+
whiteSpace: 'nowrap',
|
|
81
82
|
fontWeight: theme.typography.fontWeightRegular
|
|
82
83
|
},
|
|
83
84
|
[`&.${chartsTooltipClasses.valueCell}, &.${chartsTooltipClasses.axisValueCell}`]: {
|
|
@@ -23,4 +23,4 @@ export interface ChartsTooltipClasses {
|
|
|
23
23
|
export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markContainer' | 'labelCell' | 'valueCell'>;
|
|
24
24
|
export declare function getChartsTooltipUtilityClass(slot: string): string;
|
|
25
25
|
export declare const chartsTooltipClasses: ChartsTooltipClasses;
|
|
26
|
-
export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "
|
|
26
|
+
export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "paper" | "markContainer" | "labelCell" | "valueCell" | "axisValueCell", string>;
|
|
@@ -3534,7 +3534,7 @@ export declare const useAxisProps: (inProps: ChartsXAxisProps) => {
|
|
|
3534
3534
|
tickNumber: number;
|
|
3535
3535
|
positionSign: number;
|
|
3536
3536
|
skipAxisRendering: boolean;
|
|
3537
|
-
classes: Record<"
|
|
3537
|
+
classes: Record<"line" | "root" | "label" | "tickContainer" | "tick" | "tickLabel", string>;
|
|
3538
3538
|
Line: string | import("react").JSXElementConstructor<import("react").SVGAttributes<SVGPathElement>>;
|
|
3539
3539
|
Tick: string | import("react").JSXElementConstructor<import("react").SVGAttributes<SVGPathElement>>;
|
|
3540
3540
|
TickLabel: import("react").JSXElementConstructor<ChartsTextProps> | typeof ChartsText;
|
|
@@ -3543,18 +3543,19 @@ export declare const useAxisProps: (inProps: ChartsXAxisProps) => {
|
|
|
3543
3543
|
lineHeight?: number | undefined;
|
|
3544
3544
|
ownerState: any;
|
|
3545
3545
|
string?: number | string | undefined | undefined;
|
|
3546
|
-
mask?: string | undefined | undefined;
|
|
3547
|
-
fill?: string | undefined | undefined;
|
|
3548
3546
|
type?: string | undefined | undefined;
|
|
3549
3547
|
filter?: string | undefined | undefined;
|
|
3548
|
+
fill?: string | undefined | undefined;
|
|
3550
3549
|
values?: string | undefined | undefined;
|
|
3550
|
+
mask?: string | undefined | undefined;
|
|
3551
3551
|
clipPath?: string | undefined | undefined;
|
|
3552
3552
|
path?: string | undefined | undefined;
|
|
3553
3553
|
direction?: number | string | undefined | undefined;
|
|
3554
3554
|
spacing?: number | string | undefined | undefined;
|
|
3555
3555
|
name?: string | undefined | undefined;
|
|
3556
|
-
fontWeight?: number | string | undefined | undefined;
|
|
3557
3556
|
color?: string | undefined | undefined;
|
|
3557
|
+
className?: string | undefined | undefined;
|
|
3558
|
+
fontWeight?: number | string | undefined | undefined;
|
|
3558
3559
|
cursor?: number | string | undefined | undefined;
|
|
3559
3560
|
display?: number | string | undefined | undefined;
|
|
3560
3561
|
fontFamily?: string | undefined | undefined;
|
|
@@ -3612,7 +3613,6 @@ export declare const useAxisProps: (inProps: ChartsXAxisProps) => {
|
|
|
3612
3613
|
vectorEffect?: number | string | undefined | undefined;
|
|
3613
3614
|
key?: import("react").Key | null | undefined;
|
|
3614
3615
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
3615
|
-
className?: string | undefined | undefined;
|
|
3616
3616
|
id?: string | undefined | undefined;
|
|
3617
3617
|
lang?: string | undefined | undefined;
|
|
3618
3618
|
tabIndex?: number | undefined | undefined;
|
|
@@ -4034,18 +4034,19 @@ export declare const useAxisProps: (inProps: ChartsXAxisProps) => {
|
|
|
4034
4034
|
lineHeight?: number | undefined;
|
|
4035
4035
|
ownerState: any;
|
|
4036
4036
|
string?: number | string | undefined | undefined;
|
|
4037
|
-
mask?: string | undefined | undefined;
|
|
4038
|
-
fill?: string | undefined | undefined;
|
|
4039
4037
|
type?: string | undefined | undefined;
|
|
4040
4038
|
filter?: string | undefined | undefined;
|
|
4039
|
+
fill?: string | undefined | undefined;
|
|
4041
4040
|
values?: string | undefined | undefined;
|
|
4041
|
+
mask?: string | undefined | undefined;
|
|
4042
4042
|
clipPath?: string | undefined | undefined;
|
|
4043
4043
|
path?: string | undefined | undefined;
|
|
4044
4044
|
direction?: number | string | undefined | undefined;
|
|
4045
4045
|
spacing?: number | string | undefined | undefined;
|
|
4046
4046
|
name?: string | undefined | undefined;
|
|
4047
|
-
fontWeight?: number | string | undefined | undefined;
|
|
4048
4047
|
color?: string | undefined | undefined;
|
|
4048
|
+
className?: string | undefined | undefined;
|
|
4049
|
+
fontWeight?: number | string | undefined | undefined;
|
|
4049
4050
|
cursor?: number | string | undefined | undefined;
|
|
4050
4051
|
display?: number | string | undefined | undefined;
|
|
4051
4052
|
fontFamily?: string | undefined | undefined;
|
|
@@ -4103,7 +4104,6 @@ export declare const useAxisProps: (inProps: ChartsXAxisProps) => {
|
|
|
4103
4104
|
vectorEffect?: number | string | undefined | undefined;
|
|
4104
4105
|
key?: import("react").Key | null | undefined;
|
|
4105
4106
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
4106
|
-
className?: string | undefined | undefined;
|
|
4107
4107
|
id?: string | undefined | undefined;
|
|
4108
4108
|
lang?: string | undefined | undefined;
|
|
4109
4109
|
tabIndex?: number | undefined | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxisConfig, ChartsXAxisProps } from "../models/axis.js";
|
|
2
|
-
export declare const useUtilityClasses: (ownerState: AxisConfig<any, any, ChartsXAxisProps>) => Record<"
|
|
2
|
+
export declare const useUtilityClasses: (ownerState: AxisConfig<any, any, ChartsXAxisProps>) => Record<"line" | "root" | "label" | "tickContainer" | "tick" | "tickLabel", string>;
|
|
3
3
|
export declare const TICK_LABEL_GAP = 3;
|
|
4
4
|
export declare const AXIS_LABEL_TICK_LABEL_GAP = 4;
|
|
5
5
|
export declare const XAxisRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, keyof import("react").SVGProps<SVGGElement> | keyof import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
6
|
+
import { isBandScale } from "../internals/isBandScale.js";
|
|
7
|
+
import { useChartContext } from "../context/ChartProvider/useChartContext.js";
|
|
8
|
+
import { TICK_LABEL_GAP, YAxisRoot } from "./utilities.js";
|
|
9
|
+
import { useTicksGrouped } from "../hooks/useTicksGrouped.js";
|
|
10
|
+
import { useAxisProps } from "./useAxisProps.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const DEFAULT_GROUPING_CONFIG = {
|
|
13
|
+
tickSize: 6
|
|
14
|
+
};
|
|
15
|
+
const getGroupingConfig = (groups, groupIndex, tickSize) => {
|
|
16
|
+
const config = groups[groupIndex] ?? {};
|
|
17
|
+
const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
|
|
18
|
+
const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
|
|
19
|
+
return _extends({}, DEFAULT_GROUPING_CONFIG, config, {
|
|
20
|
+
tickSize: config.tickSize ?? calculatedTickSize
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @ignore - internal component.
|
|
26
|
+
*/
|
|
27
|
+
function ChartsGroupedYAxis(inProps) {
|
|
28
|
+
const {
|
|
29
|
+
yScale,
|
|
30
|
+
defaultizedProps,
|
|
31
|
+
tickNumber,
|
|
32
|
+
positionSign,
|
|
33
|
+
skipAxisRendering,
|
|
34
|
+
classes,
|
|
35
|
+
Line,
|
|
36
|
+
Tick,
|
|
37
|
+
TickLabel,
|
|
38
|
+
Label,
|
|
39
|
+
axisTickLabelProps,
|
|
40
|
+
axisLabelProps,
|
|
41
|
+
lineProps
|
|
42
|
+
} = useAxisProps(inProps);
|
|
43
|
+
if (!isBandScale(yScale)) {
|
|
44
|
+
throw new Error('MUI X Charts: ChartsGroupedYAxis only supports the `band` and `point` scale types.');
|
|
45
|
+
}
|
|
46
|
+
const {
|
|
47
|
+
position,
|
|
48
|
+
disableLine,
|
|
49
|
+
disableTicks,
|
|
50
|
+
label,
|
|
51
|
+
tickSize,
|
|
52
|
+
valueFormatter,
|
|
53
|
+
slotProps,
|
|
54
|
+
tickInterval,
|
|
55
|
+
tickPlacement,
|
|
56
|
+
tickLabelPlacement,
|
|
57
|
+
sx,
|
|
58
|
+
offset,
|
|
59
|
+
width: axisWidth
|
|
60
|
+
} = defaultizedProps;
|
|
61
|
+
const groups = defaultizedProps.groups;
|
|
62
|
+
const drawingArea = useDrawingArea();
|
|
63
|
+
const {
|
|
64
|
+
left,
|
|
65
|
+
top,
|
|
66
|
+
width,
|
|
67
|
+
height
|
|
68
|
+
} = drawingArea;
|
|
69
|
+
const {
|
|
70
|
+
instance
|
|
71
|
+
} = useChartContext();
|
|
72
|
+
const labelRefPoint = {
|
|
73
|
+
x: positionSign * axisWidth,
|
|
74
|
+
y: top + height / 2
|
|
75
|
+
};
|
|
76
|
+
const yTicks = useTicksGrouped({
|
|
77
|
+
scale: yScale,
|
|
78
|
+
tickNumber,
|
|
79
|
+
valueFormatter,
|
|
80
|
+
tickInterval,
|
|
81
|
+
tickPlacement,
|
|
82
|
+
tickLabelPlacement,
|
|
83
|
+
direction: 'y',
|
|
84
|
+
groups
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Skip axis rendering if no data is available
|
|
88
|
+
// - The domain is an empty array for band/point scales.
|
|
89
|
+
// - The domains contains Infinity for continuous scales.
|
|
90
|
+
// - The position is set to 'none'.
|
|
91
|
+
if (skipAxisRendering) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/_jsxs(YAxisRoot, {
|
|
95
|
+
transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
|
|
96
|
+
className: classes.root,
|
|
97
|
+
sx: sx,
|
|
98
|
+
children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
|
|
99
|
+
y1: top,
|
|
100
|
+
y2: top + height,
|
|
101
|
+
className: classes.line
|
|
102
|
+
}, lineProps)), yTicks.map((item, index) => {
|
|
103
|
+
const {
|
|
104
|
+
offset: tickOffset,
|
|
105
|
+
labelOffset
|
|
106
|
+
} = item;
|
|
107
|
+
const yTickLabel = labelOffset ?? 0;
|
|
108
|
+
const showTick = instance.isYInside(tickOffset);
|
|
109
|
+
const tickLabel = item.formattedValue;
|
|
110
|
+
const ignoreTick = item.ignoreTick ?? false;
|
|
111
|
+
const groupIndex = item.groupIndex ?? 0;
|
|
112
|
+
const groupConfig = getGroupingConfig(groups, groupIndex, tickSize);
|
|
113
|
+
const tickXSize = positionSign * groupConfig.tickSize;
|
|
114
|
+
const labelPositionX = positionSign * (groupConfig.tickSize + TICK_LABEL_GAP);
|
|
115
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
116
|
+
transform: `translate(0, ${tickOffset})`,
|
|
117
|
+
className: classes.tickContainer,
|
|
118
|
+
"data-group-index": groupIndex,
|
|
119
|
+
children: [!disableTicks && !ignoreTick && showTick && /*#__PURE__*/_jsx(Tick, _extends({
|
|
120
|
+
x2: tickXSize,
|
|
121
|
+
className: classes.tick
|
|
122
|
+
}, slotProps?.axisTick)), tickLabel !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
123
|
+
x: labelPositionX,
|
|
124
|
+
y: yTickLabel
|
|
125
|
+
}, axisTickLabelProps, {
|
|
126
|
+
style: _extends({}, axisTickLabelProps.style, groupConfig.tickLabelStyle),
|
|
127
|
+
text: tickLabel
|
|
128
|
+
}))]
|
|
129
|
+
}, index);
|
|
130
|
+
}), label && /*#__PURE__*/_jsx("g", {
|
|
131
|
+
className: classes.label,
|
|
132
|
+
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
133
|
+
text: label
|
|
134
|
+
}))
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
export { ChartsGroupedYAxis };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useIsHydrated } from "../hooks/useIsHydrated.js";
|
|
6
|
+
import { getStringSize } from "../internals/domUtils.js";
|
|
7
|
+
import { useTicks } from "../hooks/useTicks.js";
|
|
8
|
+
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
9
|
+
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
10
|
+
import { shortenLabels } from "./shortenLabels.js";
|
|
11
|
+
import { AXIS_LABEL_TICK_LABEL_GAP, TICK_LABEL_GAP, YAxisRoot } from "./utilities.js";
|
|
12
|
+
import { useAxisProps } from "./useAxisProps.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ignore - internal component.
|
|
16
|
+
*/
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
function ChartsSingleYAxis(inProps) {
|
|
19
|
+
const {
|
|
20
|
+
yScale,
|
|
21
|
+
defaultizedProps,
|
|
22
|
+
tickNumber,
|
|
23
|
+
positionSign,
|
|
24
|
+
skipAxisRendering,
|
|
25
|
+
classes,
|
|
26
|
+
Line,
|
|
27
|
+
Tick,
|
|
28
|
+
TickLabel,
|
|
29
|
+
Label,
|
|
30
|
+
axisTickLabelProps,
|
|
31
|
+
axisLabelProps,
|
|
32
|
+
lineProps,
|
|
33
|
+
isRtl
|
|
34
|
+
} = useAxisProps(inProps);
|
|
35
|
+
const {
|
|
36
|
+
position,
|
|
37
|
+
disableLine,
|
|
38
|
+
disableTicks,
|
|
39
|
+
label,
|
|
40
|
+
tickSize: tickSizeProp,
|
|
41
|
+
valueFormatter,
|
|
42
|
+
slotProps,
|
|
43
|
+
tickPlacement,
|
|
44
|
+
tickLabelPlacement,
|
|
45
|
+
tickInterval,
|
|
46
|
+
tickLabelInterval,
|
|
47
|
+
sx,
|
|
48
|
+
offset,
|
|
49
|
+
width: axisWidth
|
|
50
|
+
} = defaultizedProps;
|
|
51
|
+
const drawingArea = useDrawingArea();
|
|
52
|
+
const {
|
|
53
|
+
left,
|
|
54
|
+
top,
|
|
55
|
+
width,
|
|
56
|
+
height
|
|
57
|
+
} = drawingArea;
|
|
58
|
+
const {
|
|
59
|
+
instance
|
|
60
|
+
} = useChartContext();
|
|
61
|
+
const isHydrated = useIsHydrated();
|
|
62
|
+
const tickSize = disableTicks ? 4 : tickSizeProp;
|
|
63
|
+
const yTicks = useTicks({
|
|
64
|
+
scale: yScale,
|
|
65
|
+
tickNumber,
|
|
66
|
+
valueFormatter,
|
|
67
|
+
tickPlacement,
|
|
68
|
+
tickLabelPlacement,
|
|
69
|
+
tickInterval,
|
|
70
|
+
direction: 'y'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Skip axis rendering if no data is available
|
|
74
|
+
// - The domain is an empty array for band/point scales.
|
|
75
|
+
// - The domains contains Infinity for continuous scales.
|
|
76
|
+
// - The position is set to 'none'.
|
|
77
|
+
if (skipAxisRendering) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const labelRefPoint = {
|
|
81
|
+
x: positionSign * axisWidth,
|
|
82
|
+
y: top + height / 2
|
|
83
|
+
};
|
|
84
|
+
/* If there's an axis title, the tick labels have less space to render */
|
|
85
|
+
const tickLabelsMaxWidth = Math.max(0, axisWidth - (label ? getStringSize(label, axisLabelProps.style).height + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
86
|
+
const tickLabels = isHydrated ? shortenLabels(yTicks, drawingArea, tickLabelsMaxWidth, isRtl, axisTickLabelProps.style) : new Map(Array.from(yTicks).map(item => [item, item.formattedValue]));
|
|
87
|
+
return /*#__PURE__*/_jsxs(YAxisRoot, {
|
|
88
|
+
transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
|
|
89
|
+
className: classes.root,
|
|
90
|
+
sx: sx,
|
|
91
|
+
children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
|
|
92
|
+
y1: top,
|
|
93
|
+
y2: top + height,
|
|
94
|
+
className: classes.line
|
|
95
|
+
}, lineProps)), yTicks.map((item, index) => {
|
|
96
|
+
const {
|
|
97
|
+
offset: tickOffset,
|
|
98
|
+
labelOffset,
|
|
99
|
+
value
|
|
100
|
+
} = item;
|
|
101
|
+
const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
|
|
102
|
+
const yTickLabel = labelOffset;
|
|
103
|
+
const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
|
|
104
|
+
const showLabel = instance.isYInside(tickOffset);
|
|
105
|
+
const tickLabel = tickLabels.get(item);
|
|
106
|
+
if (!showLabel) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
110
|
+
transform: `translate(0, ${tickOffset})`,
|
|
111
|
+
className: classes.tickContainer,
|
|
112
|
+
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
113
|
+
x2: positionSign * tickSize,
|
|
114
|
+
className: classes.tick
|
|
115
|
+
}, slotProps?.axisTick)), tickLabel !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
116
|
+
x: xTickLabel,
|
|
117
|
+
y: yTickLabel,
|
|
118
|
+
text: tickLabel
|
|
119
|
+
}, axisTickLabelProps))]
|
|
120
|
+
}, index);
|
|
121
|
+
}), label && isHydrated && /*#__PURE__*/_jsx("g", {
|
|
122
|
+
className: classes.label,
|
|
123
|
+
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
124
|
+
text: label
|
|
125
|
+
}))
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export { ChartsSingleYAxis };
|
|
@@ -9,7 +9,7 @@ import { ChartsYAxisProps } from "../models/axis.js";
|
|
|
9
9
|
*
|
|
10
10
|
* - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
|
|
11
11
|
*/
|
|
12
|
-
declare function ChartsYAxis(inProps: ChartsYAxisProps): React.JSX.Element
|
|
12
|
+
declare function ChartsYAxis(inProps: ChartsYAxisProps): React.JSX.Element;
|
|
13
13
|
declare namespace ChartsYAxis {
|
|
14
14
|
var propTypes: any;
|
|
15
15
|
}
|