chartConfig.getTitle().setText(
"Average fruit consumption during one week");
chartConfig.getSubtitle().setStyle(
"{ position: 'absolute', right: '0px', bottom: '10px'}");
Legend legend = new Legend();
legend.setFloating(true);
legend.setLayout(Layout.VERTICAL);
legend.setPosition(new Position());
legend.getPosition().setAlign(HorzAlign.RIGHT);
legend.getPosition().setVertAlign(VertAlign.TOP);
legend.getPosition().setX(-150);
legend.getPosition().setY(100);
legend.setBorderWidth(1);
legend.setBackgroundColor(new RGB(255, 255, 255));
chartConfig.setLegend(legend);
CategoryAxis xAxis = new CategoryAxis();
xAxis.setCategories(Arrays.asList("Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"));