public JFreeChart createLayeredBarChart(String title, String domainLabel, String rangeLabel, CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(title, domainLabel, rangeLabel, dataset,
PlotOrientation.HORIZONTAL, true, true, false);
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.white);
plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
ExtendedCategoryAxis domainAxis = new ExtendedCategoryAxis(null);
domainAxis.setTickLabelFont(new Font("SansSerif", Font.BOLD, 12));
domainAxis.setCategoryMargin(0.20);
plot.setDomainAxis(domainAxis);
LayeredBarRenderer renderer = new LayeredBarRenderer();
renderer.setDrawBarOutline(false);
plot.setRenderer(renderer);
plot.setRowRenderingOrder(SortOrder.DESCENDING);
GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
renderer.setSeriesPaint(0, gp0);
GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
renderer.setSeriesPaint(1, gp1);
GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
renderer.setSeriesPaint(2, gp2);
return chart;
}