[Chartjs]-Chart.js, adding footer to chart

7👍

From the official docs:

Labeling Axes

When creating a chart, you want to tell the viewer what data they are viewing. To do this, you need to label the axis.

The scale label configuration is nested under the scale configuration in the scaleLabel key. It defines options for the scale title. Note that this only applies to cartesian axes.

You can add labels for both axes but in your case, since you only need it on the x-axis, your chart options should look similar to this.

var options = {
  scales: {
    xAxes: [
      {
        scaleLabel: {
          display: true,
          labelString: 'Party size',
          fontColor: '#C7C7CC',
          fontSize: 11
        }
      }
    ]
  }
};

Leave a comment