How to Adjust Y-Axis Range in QuickChart to Add Extra Space Above Maximum Value?

problem

Hi everyone,

I’m working on a chart using QuickChart, and I’ve successfully created the visualization. However, I’m struggling to configure the Y-axis to extend its range. Specifically, I want the upper limit of the Y-axis to be 10 units higher than the maximum value in my data.

Does anyone know how to dynamically calculate and set the Y-axis range in QuickChart so that it automatically adds an extra 10 units to the highest value in the dataset?

Thanks in advance for your help!

Here my code:

{
type: “bar”,
data: {
labels: [‘,’“',substitute(Select(Instructivo Filtrado[idie],true),”,“,'”,“‘),’”‘,’],
datasets: [
{
label: “Completed (‘,SELECT(Instructivo Filtrado[Cntdre_atendidos],TRUE),’)”,
data: [‘,SELECT(Instructivo Filtrado[Cntdre_atendidos],TRUE),’],
backgroundColor: “rgba(0, 255, 3, 0.68)”,
datalabels: {
display: true, // Hide datalabels
},
},
{
label: “In Progress (‘,SELECT(Instructivo Filtrado[ cntdrs_proceso],TRUE),’)”,
data: [‘,SELECT(Instructivo Filtrado[ cntdrs_proceso],TRUE),’],
backgroundColor: “rgba(247, 255, 0, 0.69)”,
datalabels: {
display: true, // Hide datalabels
},
},
{
label: “Not Started (‘,SELECT(Instructivo Filtrado[ cntdrs_sinatencion],TRUE),’)”,
data: [‘,SELECT(Instructivo Filtrado[ cntdrs_sinatencion],TRUE),’],
backgroundColor: “rgba(255, 0, 0, 0.69)”,
datalabels: {
display: true, // Hide datalabels
align: “top”,
anchor: “end”,
color: “#000”,
backgroundColor: “pink”,
borderColor: “#000”,
borderWidth: 1,
formatter: (value, ctx) => {
// Calculate the total for each label across all datasets
const dataIndex = ctx.dataIndex;
const total = ctx.chart.data.datasets.reduce((acc, dataset) => {
return acc + dataset.data[dataIndex];
}, 0);
return total.toLocaleString(“en-US”);
},
display: true, // Display datalabels for the top dataset
},
},
],
},
options: {
title: {
display: false,
text: “Real-Time Chart”,
},
legend: {
display: true,
position : “right”,
},
scales: {
yAxes: [
{
stacked: true,
ticks: {
beginAtZero: true,
},
},
],
xAxes: [
{
stacked: true,
},
],
},
},
}