-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[charts] Fix themeAugmentation (#14372)
Signed-off-by: Jose C Quintas Jr <juniorquintas@gmail.com> Co-authored-by: Jose C Quintas Jr <juniorquintas@gmail.com>
- Loading branch information
1 parent
cf441ec
commit 9e72473
Showing
29 changed files
with
213 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as React from 'react'; | ||
import { DrawingArea } from '../context/DrawingProvider'; | ||
import { useTicks } from '../hooks/useTicks'; | ||
import { AxisDefaultized, ChartsYAxisProps, ScaleName } from '../models/axis'; | ||
import { GridLine } from './styledCommonents'; | ||
import { ChartsGridClasses } from './chartsGridClasses'; | ||
|
||
interface ChartsGridHorizontalProps { | ||
axis: AxisDefaultized<ScaleName, any, ChartsYAxisProps>; | ||
drawingArea: DrawingArea; | ||
classes: Partial<ChartsGridClasses>; | ||
} | ||
|
||
/** | ||
* @ignore - internal component. | ||
*/ | ||
export function ChartsGridHorizontal(props: ChartsGridHorizontalProps) { | ||
const { axis, drawingArea, classes } = props; | ||
|
||
const { scale, tickNumber, tickInterval } = axis; | ||
|
||
const yTicks = useTicks({ scale, tickNumber, tickInterval }); | ||
|
||
return ( | ||
<React.Fragment> | ||
{yTicks.map(({ formattedValue, offset }) => ( | ||
<GridLine | ||
key={`horizontal-${formattedValue}`} | ||
y1={offset} | ||
y2={offset} | ||
x1={drawingArea.left} | ||
x2={drawingArea.left + drawingArea.width} | ||
className={classes.horizontalLine} | ||
/> | ||
))} | ||
</React.Fragment> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as React from 'react'; | ||
import { DrawingArea } from '../context/DrawingProvider'; | ||
import { useTicks } from '../hooks/useTicks'; | ||
import { AxisDefaultized, ChartsXAxisProps, ScaleName } from '../models/axis'; | ||
import { GridLine } from './styledCommonents'; | ||
import { ChartsGridClasses } from './chartsGridClasses'; | ||
|
||
interface ChartsGridVerticalProps { | ||
axis: AxisDefaultized<ScaleName, any, ChartsXAxisProps>; | ||
drawingArea: DrawingArea; | ||
classes: Partial<ChartsGridClasses>; | ||
} | ||
|
||
/** | ||
* @ignore - internal component. | ||
*/ | ||
export function ChartsGridVertical(props: ChartsGridVerticalProps) { | ||
const { axis, drawingArea, classes } = props; | ||
|
||
const { scale, tickNumber, tickInterval } = axis; | ||
|
||
const xTicks = useTicks({ scale, tickNumber, tickInterval }); | ||
|
||
return ( | ||
<React.Fragment> | ||
{xTicks.map(({ formattedValue, offset }) => ( | ||
<GridLine | ||
key={`vertical-${formattedValue}`} | ||
y1={drawingArea.top} | ||
y2={drawingArea.top + drawingArea.height} | ||
x1={offset} | ||
x2={offset} | ||
className={classes.verticalLine} | ||
/> | ||
))} | ||
</React.Fragment> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { styled } from '@mui/material/styles'; | ||
import { chartsGridClasses } from './chartsGridClasses'; | ||
|
||
export const GridRoot = styled('g', { | ||
name: 'MuiChartsGrid', | ||
slot: 'Root', | ||
overridesResolver: (props, styles) => [ | ||
{ [`&.${chartsGridClasses.verticalLine}`]: styles.verticalLine }, | ||
{ [`&.${chartsGridClasses.horizontalLine}`]: styles.horizontalLine }, | ||
styles.root, | ||
], | ||
})({}); | ||
|
||
export const GridLine = styled('line', { | ||
name: 'MuiChartsGrid', | ||
slot: 'Line', | ||
overridesResolver: (props, styles) => styles.line, | ||
})(({ theme }) => ({ | ||
stroke: (theme.vars || theme).palette.divider, | ||
shapeRendering: 'crispEdges', | ||
strokeWidth: 1, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.