highcharts

Highcharts column chart - First and last column width smaller than rest if pointPlacement is "on" . How to fix it?


When Im using pointPlacement="on"the first and last columns width is smaller than the rest. I believe that the first column moves not to the start of the xAxis but too much to the left and last column too much to the right. How can I give all columns same width? Thanks!

https://jsfiddle.net/J_Code_2025/8bh0kenm/2/


Solution

  • You need to set tickmarkPlacement: "on" and adapt by min and max properties. For example:

      xAxis: {
        offset: 0,
        tickmarkPlacement: "on",
        min: -0.07,
        max: 5.07,
        categories: ["USA", "China", "Brazil", "EU", "Argentina", "India"]
      }
    

    Live demo: https://jsfiddle.net/BlackLabel/kgpzd1t3/

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