How can I change the maximum width/height an item bar has in Apexcharts? (https://apexcharts.com/)
I have an horizontal bar chart whose data are loaded dynamically and the number of users (items) varies. When there are few or only one user the bar looks very huge, I would like to set the height to max 50px.
The code:
var timeChart = {
formatter: function (value) {
var v = formatFromSeconds(value);
return v;
}
};
var desv_time = function (value) {
var v = formatFromSeconds(value);
if (value>0)return "+"+v;
else return v;
}
//CHART
var chart1 = new ApexCharts( document.querySelector("#chart-desv"),
{
chart: {
id: 'chart1',
type: 'bar'
},
plotOptions: {
bar: {
horizontal: true,
},
},
dataLabels: {
enabled: true,
formatter: desv_time,
style: {
colors: ["#000"]
}
},
series: [],
xaxis: {labels: {
formatter: desv_time,
}},
tooltip: {
followCursor: true,
x: {
formatter: function(value) {
return value;
},
},
y: {
formatter: desv_time,
title: {formatter: (seriesName) => 'Time difference',}
},
marker: {show:false}
},
title: { text: "Usual workday duration: 08:00", align: "center" }
});
chart1.render();
Screenshot (very huge bar with one user):