List of usage examples for org.jfree.chart.renderer.category GroupedStackedBarRenderer setBarPainter
public void setBarPainter(BarPainter painter)
From source file:org.psystems.dicom.browser.server.stat.StatDailyLoadChartServlet2.java
private JFreeChart getChart(CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createStackedBarChart("Stacked Bar Chart Demo 4", // chart title "Category", // domain axis label "", // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation true, // legend true, // tooltips false // urls );//from ww w . j a v a 2 s . co m TextTitle title = new TextTitle(" ()", labelFont); title.setPaint(new Color(68, 99, 156)); chart.setTitle(title); GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer(); KeyToGroupMap map = new KeyToGroupMap("G1"); map.mapKeyToGroup("product 1 (US)", "G1"); map.mapKeyToGroup("product 1 (Europe)", "G1"); renderer.setSeriesToGroupMap(map); BarPainter b = new StandardBarPainter(); // BarPainter b = new GradientBarPainter(0,0.9,0.9); renderer.setBarPainter(b); renderer.setSeriesPaint(0, color1); renderer.setSeriesPaint(1, color2); SubCategoryAxis domainAxis = new SubCategoryAxis("DCM / JPG "); domainAxis.setCategoryMargin(0.05); domainAxis.setTickLabelFont(dateFont); // domainAxis.addSubCategory("Product 1"); // domainAxis.addSubCategory("Product 2"); // domainAxis.addSubCategory("Product 3"); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainAxis(domainAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.red); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis v = plot.getRangeAxis(); v.setTickLabelFont(dateFont); // plot.setRangeAxis(ValueAxis); //plot.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT); plot.setRenderer(renderer); plot.setFixedLegendItems(createLegendItems()); return chart; }
From source file:org.psystems.dicom.browser.server.stat.StatClientRequestsChartServlet2.java
private JFreeChart getChart(CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createStackedBarChart("Stacked Bar Chart Demo 4", // chart title "Category", // domain axis label "", // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation true, // legend true, // tooltips false // urls );/* w w w. ja va 2 s. c o m*/ TextTitle title = new TextTitle("? ? ? (.)", labelFont); title.setPaint(new Color(68, 99, 156)); chart.setTitle(title); GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer(); KeyToGroupMap map = new KeyToGroupMap("G1"); map.mapKeyToGroup("product 1 (US)", "G1"); map.mapKeyToGroup("product 1 (Europe)", "G1"); renderer.setSeriesToGroupMap(map); BarPainter b = new StandardBarPainter(); // BarPainter b = new GradientBarPainter(0,0.9,0.9); renderer.setBarPainter(b); renderer.setSeriesPaint(0, color1); renderer.setSeriesPaint(1, color2); SubCategoryAxis domainAxis = new SubCategoryAxis(" / "); domainAxis.setCategoryMargin(0.05); domainAxis.setTickLabelFont(dateFont); // domainAxis.addSubCategory("Product 1"); // domainAxis.addSubCategory("Product 2"); // domainAxis.addSubCategory("Product 3"); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainAxis(domainAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.red); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis v = plot.getRangeAxis(); v.setTickLabelFont(dateFont); // plot.setRangeAxis(ValueAxis); //plot.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT); plot.setRenderer(renderer); plot.setFixedLegendItems(createLegendItems()); return chart; }