Skip to content
Snippets Groups Projects
Commit 699db497 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #117 in chartsmonth as well

parent bfd760b6
No related branches found
No related tags found
2 merge requests!142merge v1_3_0 into master,!121Merge Reports into v1_3_0
......@@ -145,12 +145,21 @@ public class MonthChartGenerator
legendItems.add(getLegendItem(label, currentItem.getColor()));
}
int legendWidth = (int)Math.ceil(Math.sqrt(legendItems.size()));
int legendWidth;
int numberOfItems = legendItems.size();
if(numberOfItems <= 3)
{
legendWidth = numberOfItems;
}
else
{
legendWidth = (int)Math.ceil(Math.sqrt(numberOfItems));
}
for(int i = 0; i < legendItems.size(); i++)
for(int i = 0; i < numberOfItems; i++)
{
int columnIndex = i % legendWidth;
int rowIndex = i / 4;
int rowIndex = i / legendWidth;
legend.add(legendItems.get(i), columnIndex, rowIndex);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment