Highcharts Label Rotated Column Chart

To create a rotated column chart with rotated labels using Highcharts, you can follow these steps:

  • Include the Highcharts library in your HTML file. You can either download it from the Highcharts website or include it from a CDN like this:
<script src="https://code.highcharts.com/highcharts.js"></script>
  • Create a container element for the chart in your HTML file, like this:
<div id="chart-container"></div>
  • In your JavaScript code, create a Highcharts chart object and configure it with the data and chart options. For example:
Highcharts.chart('chart-container', {
  chart: {
    type: 'column',
    events: {
      load: function() {
        var chart = this;
        chart.renderer.text('X Axis Label', chart.plotLeft + chart.plotWidth / 2, chart.plotTop + chart.plotHeight + 35)
          .attr({
            align: 'center'
          })
          .add();
      }
    }
  },
  title: {
    text: 'Rotated Column Chart with Rotated Labels'
  },
  xAxis: {
    categories: ['Category 1', 'Category 2', 'Category 3', 'Category 4', 'Category 5'],
    labels: {
      rotation: -45,
      align: 'right',
      style: {
        fontSize: '13px',
        fontFamily: 'Verdana, sans-serif'
      }
    }
  },
  yAxis: {
    min: 0,
    title: {
      text: 'Values'
    }
  },
  legend: {
    enabled: false
  },
  series: [{
    name: 'Series 1',
    data: [5, 7, 3, 6, 4]
  }]
});

In this example, we're creating a rotated column chart with the Highcharts chart function and passing in a set of options:

  • chart.type is set to 'column' to create a column chart
  • chart.events.load is used to add a custom x-axis label to the chart. We're using the chart.renderer.text method to create the label as an SVG text element, and positioning it at the bottom of the chart.
  • title.text is set to 'Rotated Column Chart with Rotated Labels' to set the main title
  • xAxis.categories is set to an array of category labels for the x-axis
  • xAxis.labels.rotation is set to -45 to rotate the x-axis labels by 45 degrees counterclockwise
  • xAxis.labels.align is set to 'right' to align the labels with the right edge of the column
  • xAxis.labels.style is used to set the font size and family for the labels
  • yAxis.min is set to 0 to set the minimum value of the y-axis
  • yAxis.title is set to set the label for the y-axis
  • legend.enabled is set to false to disable the legend
  • series is set to an array of objects with a name and data property to define the series data

With these options, you can create a rotated column chart with rotated labels and customizable data and appearance.

  1. Customizing appearance in Highcharts Rotated Label Column Chart: To customize the appearance of a Rotated Label Column Chart in Highcharts, you can use options like colors, borders, and more. Here's an example code snippet:

    Highcharts.chart('container', {
        chart: {
            type: 'column'
        },
        plotOptions: {
            column: {
                color: 'skyblue',
                borderColor: 'white',
                borderWidth: 2
            }
        },
        series: [{
            name: 'Data',
            data: [10, 15, 20, 25, 30]
        }]
    });
    
  2. Adding data to Highcharts Label Rotated Column Chart: To add data to the Label Rotated Column Chart, you can use the data property within the series object. Here's an example:

    series: [{
        name: 'Data',
        data: [10, 15, 20, 25, 30]
    }]
    
  3. Highcharts Label Rotation configuration options: For rotating labels, use the xAxis.labels.rotation property in the chart configuration. Here's an example:

    xAxis: {
        categories: ['Category 1', 'Category 2', 'Category 3', 'Category 4', 'Category 5'],
        labels: {
            rotation: -45
        }
    }
    
  4. Rotated Label Stacked Column Chart in Highcharts: To create a Rotated Label Stacked Column Chart, use the stacking property in the plot options. Here's an example:

    plotOptions: {
        column: {
            stacking: 'normal'
        }
    },
    series: [{
        name: 'Category 1',
        data: [10, 15, 20, 25, 30]
    }, {
        name: 'Category 2',
        data: [5, 10, 15, 20, 25]
    }]
    
  5. Grouped Rotated Label Column Chart using Highcharts: To create a grouped Rotated Label Column Chart, omit the stacking property. Here's an example:

    plotOptions: {
        column: {
            // No stacking property for grouped chart
        }
    },
    series: [{
        name: 'Category 1',
        data: [10, 15, 20, 25, 30]
    }, {
        name: 'Category 2',
        data: [5, 10, 15, 20, 25]
    }]
    
  6. Interactive features in Highcharts Label Rotated Column Chart: Highcharts supports interactive features like tooltips, click events, and legends. You can enable these features to enhance user interaction. Here's a snippet for tooltip configuration:

    tooltip: {
        pointFormat: 'Value: {point.y}'
    }