Chartjs-Chartjs – Insert labels at xAxes

0πŸ‘

I found that’s solution for my problem:

	scales: {
				xAxes: [{
					type: "time",
					time: {
						unit: 'day',
						unitStepSize: 1,
						displayFormats: {
							'day': 'DD MMM'
						}
					},
					ticks: {
						// maxRotation: 0 ,
						major: {
							enabled: true,
							fontStyle: 'bold',
							fontSize: 14,
							callback: function (value, index, values) {
								if (values[index] !== undefined) {
									if (values[index].major == true) {
										return moment(values[index].value).format('DD MMM');
									}
									else {
										return value;
									}
								}
							}
						},
					},



				}],

Leave a comment