Reputation: 838
I'm using PrimeNG charts (based on chart.js). I know want to set the maximum number of LABELS to show. The docs show this: ticks.max String - The maximum item to display. Must be a value in the labels array
but I don't know where to put it and couldn't find anything anywhere in the interwebs. My chart options look like this right now:
this.options = {
animation: false,
legend: {
display: true,
labels: {
boxWidth: 0,
}
},
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: "ms"
},
ticks: {
beginAtZero: true,
suggestedMax: 100,
}
}],
xAxes: [{
scaleLabel: {
display: true,
labelString: "sec"
},
ticks: {
beginAtZero: true,
}
}]
}
}
I've tried adding ticks.max on different places in my options, but I always get a "unexpected token" error. I can set a "max" value within "ticks", but this hast do be a number and is not what im looking for. And, also, the docs above tell that ticks.max is a string from the labels array. So the "max" value within the ticks object definitely has to be something else.
This might be a stupid question, but I was searching for very long time and couldn't help but ask.
Upvotes: 2
Views: 2240
Reputation: 3387
According to documentation if you want to create a Category Scale
should work like this:
.....
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: "ms"
},
ticks: {
beginAtZero: true,
suggestedMax: 100,
}
}],
xAxes: [{
scaleLabel: {
display: true,
labelString: "sec"
},
ticks: {
beginAtZero: true,
max: "a-value-from-array"
}
}]
}
I'm tempted to guess that you are using a notation like:
var y = { ticks.max: "hello" }
VM181:1 Uncaught SyntaxError: Unexpected token .
I think that explains your error.
Upvotes: 2