简体   繁体   中英

Padding between X-Axis labels in Highchart

Can anyone help me out here? We are trying to implement Highchart for our web application, but in some charts the X-Axis labels are overlapping, due to closer points.

The code we are using for the X-Axis:

Highcharts.setOptions({
  xAxis: {
    gridLineWidth: 1,
    lineColor: '#000',
    tickColor: '#000',
    labels: {
      style: {
        color: '#000',
        font: '11px Trebuchet MS, Verdana, sans-serif',
      }
    },
    title: {
      style: {
        color: '#333',
        fontWeight: 'bold',
        fontSize: '12px',
        fontFamily: 'Trebuchet MS, Verdana, sans-serif'
      }
    }
  }
})

and

setXAxisParameters = {
  categories: xAxisCategories,
  title: {
    text: xAxisTitle
  },
  labels: {
    formatter: function() {
      xVal = (this.value).split("#")[0];
      if(xVal != '')
        return xVal;
      else
        return '';
    },
    y: 5,
    rotation: 90,
    align: 'left'
  }
}

Thanks in advance.

Without seeing an example of your data it is hard to tell how they are overlapping. You can try changing the orientation of the labels to be vertical ( rotation ) and/or change other options of the labels ( labels ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM