use of org.jfree.chart.renderer.category.CategoryItemRenderer in project adempiere by adempiere.
the class GraphBuilder method setupCategoryChart.
private void setupCategoryChart(JFreeChart chart) {
CategoryPlot plot = chart.getCategoryPlot();
CategoryItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(0, new Color(92 / 255f, 178 / 255f, 232 / 255f));
renderer.setSeriesPaint(1, new Color(56 / 255f, 97 / 255f, 119 / 255f));
renderer.setSeriesPaint(2, new Color(242 / 255f, 70 / 255f, 78 / 255f));
renderer.setSeriesPaint(3, Color.orange);
renderer.setSeriesPaint(4, new Color(147 / 255f, 196 / 255f, 51 / 255f));
renderer.setSeriesPaint(5, new Color(210 / 255f, 247 / 255f, 91 / 255f));
renderer.setSeriesPaint(6, new Color(129 / 255f, 235 / 255f, 249 / 255f));
renderer.setSeriesPaint(7, new Color(60 / 255f, 84 / 255f, 8 / 255f));
renderer.setSeriesPaint(8, new Color(0.8f, 0.8f, 0.8f));
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project qpid-broker-j by apache.
the class CategoryStrokeAndPaintApplier method setSeriesShape.
@Override
public void setSeriesShape(final int seriesIndex, final java.awt.Shape shape, final JFreeChart targetChart) {
CategoryItemRenderer renderer = targetChart.getCategoryPlot().getRenderer();
if (renderer instanceof LineAndShapeRenderer) {
LineAndShapeRenderer lineAndShapeRenderer = (LineAndShapeRenderer) renderer;
lineAndShapeRenderer.setSeriesShapesVisible(seriesIndex, true);
lineAndShapeRenderer.setSeriesShape(seriesIndex, shape);
}
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project qpid-broker-j by apache.
the class StatisticalBarChartBuilder method createChartImpl.
@Override
public JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls) {
CategoryAxis xAxis = new CategoryAxis(xAxisTitle);
ValueAxis yAxis = new NumberAxis(yAxisTitle);
CategoryItemRenderer renderer = new StatisticalBarRenderer();
CategoryPlot plot = new CategoryPlot((StatisticalCategoryDataset) dataset, xAxis, yAxis, renderer);
JFreeChart chart = new JFreeChart(title, new Font("Arial", Font.PLAIN, 10), plot, true);
chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
return chart;
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project processdash by dtuma.
the class AreaChart method configureConsistentColors.
private void configureConsistentColors(CategoryPlot plot, CategoryDataset catData) {
DefaultDrawingSupplier s = new DefaultDrawingSupplier();
String skip = getParameter("consistentSkip");
if (skip != null)
for (int i = Integer.parseInt(skip); i-- > 0; ) s.getNextPaint();
CategoryItemRenderer rend = plot.getRenderer();
for (int i = 0; i < catData.getRowCount(); i++) {
Paint paint = s.getNextPaint();
rend.setSeriesPaint(i, paint);
}
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project xwiki-platform by xwiki.
the class BarPlotFactory method create.
@Override
public Plot create(DataSource dataSource, ChartParams params) throws GenerateException, DataSourceException {
Class rendererClass = params.getClass(ChartParams.RENDERER);
if (rendererClass == null || CategoryItemRenderer.class.isAssignableFrom(rendererClass)) {
CategoryItemRenderer renderer;
if (rendererClass != null) {
try {
Constructor ctor = rendererClass.getConstructor(new Class[] {});
renderer = (CategoryItemRenderer) ctor.newInstance(new Object[] {});
} catch (Throwable e) {
throw new GenerateException(e);
}
} else {
renderer = new BarRenderer();
}
return CategoryPlotFactory.getInstance().create(dataSource, renderer, params);
} else if (XYItemRenderer.class.isAssignableFrom(rendererClass)) {
XYItemRenderer renderer;
try {
Constructor ctor = rendererClass.getConstructor(new Class[] {});
renderer = (XYItemRenderer) ctor.newInstance(new Object[] {});
} catch (Throwable e) {
throw new GenerateException(e);
}
ChartCustomizer.customizeXYItemRenderer(renderer, params);
return XYPlotFactory.getInstance().create(dataSource, renderer, params);
} else {
throw new GenerateException("Incompatible renderer class: " + rendererClass);
}
}
Aggregations