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

204
Vistas
Set column width depending on max datalabel value

$(function() {

  $('#container').highcharts({

    chart: {
      type: 'heatmap',
      marginTop: 40,
      marginBottom: 80,
      plotBorderWidth: 1,
      events: {
        load: function() {
            this.yAxis.forEach(function(xAxis) {
            xAxis.update({
                tickLength: xAxis.maxLabelLength + xAxis.minPixelPadding
            }, false);
          });
          this.redraw();
        }
      }
    },




    xAxis: {
      categories: ['']
    },

    yAxis: [{
      categories: ['', '', '']
    }],

    

    series: [{
      borderWidth: 1,
      dataLabels : {
                          enabled: true,
                          format: '{point.value}'  
                        }   ,
      data: [
        {x: 0, y:0, value: "c"},
        {x: 0, y:1, value: "b"},
        {x: 0, y:2, value: "this wont fit conlumn width aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        },
      ]     
      
    }]

  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/heatmap.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>


<div id="container" style="height: 400px; min-width: 310px; max-width: 800px; margin: 0 auto"></div>

I'm using the high chart and I need that the column width fits with the maximum length of the max data labels.

In my example you can see the problem clearly:

[http://jsfiddle.net/aferpq9m/1/]

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to use breaks. For example:

xAxis: {
  categories: [''],
  breaks: [{
    from: 0.5,
    to: 0.9,
    breakSize: 0
  }, {
    from: 1,
    to: 1.5,
    breakSize: 0
  }, {
    from: 1.5,
    to: 2,
    breakSize: 0
  }]
}

Live demo: http://jsfiddle.net/BlackLabel/2hrc1xdf/

API Reference: https://api.highcharts.com/highcharts/xAxis.breaks

about 4 years ago · Juan Pablo Isaza Denunciar
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