Skip to content

Commit

Permalink
feat: update renderAxis to convert tick props
Browse files Browse the repository at this point in the history
This commit updates the renderAxis function in the Chart component to convert tick props using the convertTickProps function. This ensures that tick rendering is consistent.
  • Loading branch information
AndresKindel committed Oct 25, 2024
1 parent bd6990b commit a75022a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/components/Chart/Tick.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react'

import { TickProps } from './model'
import { convertTickProps } from './renderAxis'

export function Tick(props: TickProps) {
const {
payload: { value },
} = props

return <text {...props}> {props.isOutlierIndicator ? `>${props.domainMaxValue}` : value} </text>
return <text {...convertTickProps(props)}> {props.isOutlierIndicator ? `>${props.domainMaxValue}` : value} </text>
}
10 changes: 7 additions & 3 deletions src/components/Chart/renderAxis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ function getAxisProps(
ticks: domainPoints,
interval: 0,
tick: axisOptions.tickRenderer
? (props) => axisOptions.tickRenderer(props, axisDomain.end, hasOutliers && props.index === outliersIndex)
? (props) =>
axisOptions.tickRenderer(
convertTickProps(props),
axisDomain.end,
hasOutliers && props.index === outliersIndex
)
: (props) => (
<Tick
{...props}
Expand Down Expand Up @@ -139,8 +144,7 @@ function getAxisProps(
}
}

// TODO: Talvez o problema da outra issue esteja aquitalvez o problema esteja aqui
const convertTickProps = (props: any): TickProps => ({
export const convertTickProps = (props: any): TickProps => ({
fill: props.fill,
height: props.height,
payload: props.payload,
Expand Down

0 comments on commit a75022a

Please sign in to comment.