Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with enough items legend takes all space, series becomes invisible #1835

Closed
techpuls-damir opened this issue Aug 13, 2020 · 3 comments
Closed
Labels
bug Something isn't working legend

Comments

@techpuls-damir
Copy link

With enough data items legend pushes out chart area so it becomes invisible. The problem is especially common on mobile.
Is there a way to reserve space for chart area. (legend should probably be scrollable or pageable)

This is JS needed in example CodePen, it is horizonal stacked barchart but it is same with other chart types:

var options = {
legend: { horizontalAlign: "left", position: "bottom" },
chart: {
toolbar: { show: false },
type: "bar",
stacked: true,
height: 300,
width: 200,
stackType: "100%"
},
series: [
{ data: [1], name: "Series Name 1" },
{ data: [2], name: "Series name 2" },
{ data: [3], name: "Series name 3" },
{ data: [4], name: "Series name 4" },
{ data: [5], name: "Series name 5" },
{ data: [6], name: "Series name 6" },
{ data: [7], name: "Series name 7" },
{ data: [8], name: "Series name 8" },
{ data: [9], name: "Series name 9" },
{ data: [10], name: "Series name 10" },
{ data: [11], name: "Series name 11" },
{ data: [12], name: "Series name 12" },
],
grid: { show: false },
plotOptions: { bar: { horizontal: true } },
xaxis: {
categories: [""],
floating: true,
axisTicks: { show: false },
axisBorder: { show: false },
labels: { show: false }
},
yaxis: {
floating: true,
axisTicks: { show: false },
axisBorder: { show: false },
labels: { show: false }
}
};

var chart = new ApexCharts(document.querySelector("#chart"), options);

chart.render();

@junedchhipa junedchhipa added legend bug Something isn't working labels Aug 13, 2020
@Arjun3023
Copy link

Hey. Sorry to disturb, but any updates on this?
I've been facing the same issue too.

@Arjun3023
Copy link

Temporarily, you can customize the css

.apexcharts-legend{
    max-height: 50px !important;
}

@junedchhipa
Copy link
Contributor

You also have an option to set the legend's height in the config

legend: {
  height: 100
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working legend
Projects
None yet
Development

No branches or pull requests

3 participants