[Chartjs]-Non numeric for x-axis in scatter chart in CHART.js

2👍

I do not believe what you are asking is achievable with scatter chart. Documentation says it only accepts data in a point format. Hence your data definition is even incorrect. You can use line chart and give data in an array format (only y-axis values) and provide labels property as array of strings you wish to display as x-axis labels. See the starting example for an illustration.

12👍

It is achievable, it is on the documentation. As part of axis definition:

let chart = new Chart(ctx, {
type: …
data: …
options: {
scales: {
xAxes: [{
type: ‘category’,
labels: [‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’]
}]
}
}
});

on: https://www.chartjs.org/docs/latest/axes/cartesian/category.html

Leave a comment