Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

441
Visualizações
How to create constant space between bars/columns in Highcharts?

When I say space, I mean not only the space between bars/columns, but also the space between the sides of the chart (y axis and other size). I am looking at this example

Highcharts.chart('container', {
  chart: {
    type: 'column',
  },

  plotOptions: {
    column: {
      stacking: 'normal',
      groupPadding: 0.3,
      pointPadding: 0,
      pointWidth: 20,
    }
  },
  series: [{
    data: [5, 3, 4]
  }, {
    data: [2, 2, 3]
  }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>


<div id="container"></div>

Spacing example

As you see, there is EQUAL SPACING between 0-1, and 1-2, BUT the spacing it NOT equal between the Y-Axis to 0, and 2 to the right side of the chart (the opposite side of the Y axis). How do I adjust these? Can I set them to a set pixel padding/margin for between the Y axis and the 0 bar, and similarly to the other side?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use minPadding and maxPadding properties, but their value is relative to the length of the axis.


You can also define pointRange as 2 and correct ticks by using tickPositions or tickPositioner:

plotOptions: {
    column: {
        stacking: 'normal',
        pointRange: 2,
        pointWidth: 20,
    }
},
xAxis: {
    maxPadding: 0,
    minPadding: 0,
    tickPositions: [0, 1, 2]
},

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


Finally, you can reset default margins and specify min and max for the x-axis:

plotOptions: {
    column: {
        stacking: 'normal',
        pointRange: 0,
        pointWidth: 20,
    }
},
xAxis: {
    maxPadding: 0,
    minPadding: 0,
    min: -1,
    max: 3
},

Live demo: http://jsfiddle.net/BlackLabel/96pw12u0/


API Reference:

https://api.highcharts.com/highcharts/xAxis.minPadding

https://api.highcharts.com/highcharts/series.column.pointRange

https://api.highcharts.com/highcharts/xAxis.tickPositioner

https://api.highcharts.com/highcharts/xAxis.min

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda