Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

373
Vistas
Rechart xAxis label overflow bug

I am having an issue with recharts library, in this case BarChart component

What i want to achieve is to customize the label text in xAxis, i already created a custom component for tick, to make text too long having ellipsis or something like this, but seems i can't do anything for text overflow or decide any size. Here's my code so far:

function renderTicks(props) {
  console.log(props)
  const space = props.width / props.visibleTicksCount
  console.log(space)
  const stringLength = props.payload.value.length * 7
  console.log(stringLength)
  return (
    <text 
    style={{ fontSize: 10 }}
    width={70} verticalAnchor="start" textAnchor="middle" x={props.x} y={props.y}>{props.payload.value}</text>
  )
}

function BarChart({ config = {}, data = {} }) {
  console.log(data)
  return (
    <StyledChart width={450} height={450} data={data} >
      <XAxis
        tick={renderTicks}
        height={100}
        interval={0} dataKey="name" >
        <Label value="" content={<LabelCustom />} />
      </XAxis>
      <YAxis />
      <Tooltip />
      <Bar dataKey="value" fill={colorsChart[0]} />
    </StyledChart>
  );
}

Here is the current behaviour:

enter image description here

I found lot of problem like this browsering the problem but not valid solution, any tip is appreciated

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda