List of usage examples for org.jfree.chart.axis NumberAxis3D NumberAxis3D
public NumberAxis3D(String label)
From source file:org.pentaho.platform.uifoundation.chart.JFreeChartEngine.java
private static JFreeChart createXYZSeriesCollectionChart( final XYZSeriesCollectionChartDefinition chartDefinition) { JFreeChart chart = null;/*from www.ja v a 2 s. co m*/ // TODO Make the following accessible from the chartDefinition String domainAxisLabel = null; String rangeAxisLabel = null; boolean tooltips = true; boolean urls = true; // ----------------------------------------------------------- String title = chartDefinition.getTitle(); boolean legend = chartDefinition.isLegendIncluded(); NumberAxis domainAxis = chartDefinition.isThreeD() ? new NumberAxis3D(domainAxisLabel) : new NumberAxis(domainAxisLabel); domainAxis.setAutoRangeIncludesZero(chartDefinition.isDomainIncludesZero()); domainAxis.setAutoRangeStickyZero(chartDefinition.isDomainStickyZero()); NumberAxis rangeAxis = new NumberAxis(rangeAxisLabel); rangeAxis.setAutoRangeIncludesZero(chartDefinition.isRangeIncludesZero()); rangeAxis.setAutoRangeStickyZero(chartDefinition.isRangeStickyZero()); BubbleRenderer renderer = null; // So far only Bubble charts are supported switch (chartDefinition.getChartType()) { case BUBBLE_CHART_TYPE: renderer = new BubbleRenderer(); break; default: // should log an error if invalid chart type passed in - at least return null for no renderer return null; } if (tooltips) { // creating the label definition renderer.setToolTipGenerator(new StandardXYZToolTipGenerator(chartDefinition.getBubbleLabelContent(), chartDefinition.getXFormat(), chartDefinition.getYFormat(), chartDefinition.getZFormat())); } if (urls) { renderer.setURLGenerator(new StandardBubbleURLGenerator()); } renderer.setMaxSize(chartDefinition.getMaxBubbleSize()); renderer.setMaxZ(chartDefinition.getMaxZValue()); XYPlot plot = new XYPlot(chartDefinition, domainAxis, rangeAxis, renderer); JFreeChartEngine.updatePlot(plot, chartDefinition); chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
From source file:com.tonbeller.jpivot.chart.ChartFactory.java
/** * Creates a stacked vertical bar chart with default settings. * * @param title the chart title./*w w w . ja va2s . c o m*/ * @param categoryAxisLabel the label for the category axis. * @param valueAxisLabel the label for the value axis. * @param data the dataset for the chart. * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return a stacked vertical bar chart. */ public static JFreeChart createStackedBarChart3D(String title, java.awt.Font titleFont, String categoryAxisLabel, String valueAxisLabel, CategoryDataset data, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls, CategoryURLGenerator urlGenerator) { // create the axes... CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); CategoryToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardCategoryToolTipGenerator(); } if (urls) { renderer.setItemURLGenerator(urlGenerator); } renderer.setToolTipGenerator(toolTipGenerator); // create the plot... CategoryPlot plot = new CategoryPlot(data, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); // create the chart... JFreeChart chart = new JFreeChart(title, titleFont, plot, legend); return chart; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.XYAreaLineChartExpression.java
protected void configureLineChart(final XYPlot plot) { final XYDataset linesDataset = createLinesDataset(); if (linesDataset == null || linesDataset.getSeriesCount() == 0) { return;//ww w .ja v a 2 s . co m } //Create Axis Objects final ValueAxis linesAxis; if (isSharedRangeAxis()) { linesAxis = plot.getRangeAxis(); } else if (isThreeD()) { linesAxis = new NumberAxis3D(getSecondValueAxisLabel()); } else { linesAxis = new NumberAxis(getSecondValueAxisLabel()); } final XYItemRenderer lineRenderer; if (isThreeD()) { lineRenderer = new XYLine3DRenderer(); } else { lineRenderer = new XYLineAndShapeRenderer(); } plot.setRenderer(1, lineRenderer); plot.setDataset(1, linesDataset); plot.setRangeAxis(1, linesAxis); //map lines to second axis plot.mapDatasetToRangeAxis(1, 1); //set location of second axis plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createBarChart3D(CategoryDataset dataset) { CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); BarRenderer3D renderer = new BarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); }//from w w w . j a v a2 s . com if (urls) { renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()); } CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setRowRenderingOrder(SortOrder.DESCENDING); plot.setColumnRenderingOrder(SortOrder.DESCENDING); } plot.setForegroundAlpha(0.75f); JFreeChart chart = new JFreeChart("Bar Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); plot.setForegroundAlpha(0.5f); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); return chart; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.BarLineChartExpression.java
public JFreeChart computeCategoryChart(final CategoryDataset barsDataset) { final JFreeChart chart = super.computeCategoryChart(barsDataset); final CategoryDataset linesDataset = createLinesDataset(); //Create the renderer with the barchart, use a different bar renderer depending //if 3D chart or not final CategoryPlot plot = chart.getCategoryPlot(); final CategoryItemRenderer lineRenderer; if (isThreeD()) { lineRenderer = new LineRenderer3D(); } else {//w w w.j ava 2 s.c o m lineRenderer = new LineAndShapeRenderer(); } //add lines dataset and axis to plot if (linesDataset != null) { //Create Axis Objects final ValueAxis linesAxis; if (isSharedRangeAxis()) { linesAxis = plot.getRangeAxis(); } else if (isThreeD()) { linesAxis = new NumberAxis3D(getSecondValueAxisLabel()); } else { linesAxis = new NumberAxis(getSecondValueAxisLabel()); } plot.setRenderer(1, lineRenderer); plot.setDataset(1, linesDataset); plot.setRangeAxis(1, linesAxis); //map lines to second axis plot.mapDatasetToRangeAxis(1, 1); //set location of second axis plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); } //set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
From source file:org.jajuk.ui.views.StatView.java
/** * Creates the bar chart3 d./*from w w w. ja va 2s. c o m*/ * * * @param title * @param categoryAxisLabel * @param valueAxisLabel * @param dataset * @param orientation * @param legend * @param tooltips * @param urls * @param format * * @return the j free chart */ public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls, String format) { if (orientation == null) throw new IllegalArgumentException("Null 'orientation' argument."); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); BarRenderer3D renderer = new BarRenderer3D(); if (tooltips) renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator(format, NumberFormat.getInstance())); if (urls) renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { plot.setRowRenderingOrder(SortOrder.DESCENDING); plot.setColumnRenderingOrder(SortOrder.DESCENDING); } plot.setForegroundAlpha(0.75F); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); ChartFactory.getChartTheme().apply(chart); return chart; }
From source file:org.pentaho.platform.uifoundation.chart.JFreeChartEngine.java
private static JFreeChart createXYSeriesCollectionChart( final XYSeriesCollectionChartDefinition chartDefinition) { JFreeChart chart = null;/*from w ww .j av a 2 s . c o m*/ // TODO Make the following accessible from the chartDefinition String domainAxisLabel = null; String rangeAxisLabel = null; boolean tooltips = true; boolean urls = true; // ----------------------------------------------------------- String title = chartDefinition.getTitle(); boolean legend = chartDefinition.isLegendIncluded(); NumberAxis domainAxis = chartDefinition.isThreeD() ? new NumberAxis3D(domainAxisLabel) : new NumberAxis(domainAxisLabel); domainAxis.setAutoRangeIncludesZero(chartDefinition.isDomainIncludesZero()); domainAxis.setAutoRangeStickyZero(chartDefinition.isDomainStickyZero()); ValueAxis rangeAxis = new NumberAxis(rangeAxisLabel); AbstractXYItemRenderer renderer = null; switch (chartDefinition.getChartType()) { case LINE_CHART_TYPE: renderer = chartDefinition.isThreeD() ? new XYLine3DRenderer() : new XYLineAndShapeRenderer(true, false); ((XYLineAndShapeRenderer) renderer).setShapesVisible(chartDefinition.isMarkersVisible()); ((XYLineAndShapeRenderer) renderer).setBaseShapesFilled(chartDefinition.isMarkersVisible()); break; case AREA_CHART_TYPE: renderer = new XYAreaRenderer(); break; case STEP_CHART_TYPE: renderer = new XYStepRenderer(); break; case STEP_AREA_CHART_TYPE: renderer = new XYStepAreaRenderer(); break; case DIFFERENCE_CHART_TYPE: renderer = new XYDifferenceRenderer(); break; case DOT_CHART_TYPE: renderer = new XYDotRenderer(); ((XYDotRenderer) renderer).setDotHeight(chartDefinition.getDotHeight()); ((XYDotRenderer) renderer).setDotWidth(chartDefinition.getDotWidth()); break; default: // should log an error if invalid chart type passed in - at least return null for no renderer return null; } if (renderer != null && legend) { renderer.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator()); } if (tooltips) { XYToolTipGenerator generator = new StandardXYToolTipGenerator(chartDefinition.getTooltipContent(), new DecimalFormat(chartDefinition.getTooltipXFormat()), new DecimalFormat(chartDefinition.getTooltipYFormat())); renderer.setToolTipGenerator(generator); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } renderer.setStroke(JFreeChartEngine.getLineStyleStroke(chartDefinition.getLineStyle(), chartDefinition.getLineWidth())); XYPlot plot = new XYPlot(chartDefinition, domainAxis, rangeAxis, renderer); JFreeChartEngine.updatePlot(plot, chartDefinition); chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createStackedBarChart3D(CategoryDataset dataset) { CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); }//from w w w . j av a 2s .c o m if (urls) { renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()); } CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart("StackedBar Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); return chart; }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createLineChart3D(CategoryDataset dataset) { CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); LineRenderer3D renderer = new LineRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); }// w w w . ja va 2 s. com if (urls) { renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()); } CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); JFreeChart chart = new JFreeChart("Line Chart Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); GradientPaint gp = new GradientPaint(0.0f, 0.0f, Color.orange, 0.0f, 0.0f, new Color(0, 64, 64)); renderer.setWallPaint(gp); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); return chart; }
From source file:org.orbeon.oxf.processor.serializer.legacy.JFreeChartSerializer.java
protected JFreeChart drawChart(ChartConfig chartConfig, final Dataset ds) { JFreeChart chart = null;/*from w ww .j ava 2 s . c om*/ Axis categoryAxis = null; if (ds instanceof XYSeriesCollection) { categoryAxis = new RestrictedNumberAxis(chartConfig.getCategoryTitle()); } else if (ds instanceof TimeSeriesCollection) { categoryAxis = new DateAxis(chartConfig.getCategoryTitle()); ((DateAxis) categoryAxis).setDateFormatOverride(new SimpleDateFormat(chartConfig.getDateFormat())); if (chartConfig.getCategoryLabelAngle() == 90) { ((DateAxis) categoryAxis).setVerticalTickLabels(true); } else { if (chartConfig.getCategoryLabelAngle() != 0) throw new OXFException( "The only supported values of category-label-angle for time-series charts are 0 or 90"); } } else { categoryAxis = new CategoryAxis(chartConfig.getCategoryTitle()); ((CategoryAxis) categoryAxis).setCategoryLabelPositions(chartConfig.getCategoryLabelPosition()); } NumberAxis valueAxis = new RestrictedNumberAxis(chartConfig.getSerieTitle()); valueAxis.setAutoRangeIncludesZero(chartConfig.getSerieAutoRangeIncludeZero()); AbstractRenderer renderer = null; Plot plot = null; switch (chartConfig.getType()) { case ChartConfig.VERTICAL_BAR_TYPE: case ChartConfig.HORIZONTAL_BAR_TYPE: renderer = (ds instanceof ItemPaintCategoryDataset) ? new BarRenderer() { public Paint getItemPaint(int row, int column) { Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column); if (p != null) return p; else return getSeriesPaint(row); } } : new BarRenderer(); plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis, (CategoryItemRenderer) renderer); if (chartConfig.getType() == ChartConfig.VERTICAL_BAR_TYPE) ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL); else ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL); break; case ChartConfig.STACKED_VERTICAL_BAR_TYPE: case ChartConfig.STACKED_HORIZONTAL_BAR_TYPE: renderer = (ds instanceof ItemPaintCategoryDataset) ? new StackedBarRenderer() { public Paint getItemPaint(int row, int column) { Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column); if (p != null) return p; else return getSeriesPaint(row); } } : new StackedBarRenderer(); plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis, (CategoryItemRenderer) renderer); if (chartConfig.getType() == ChartConfig.STACKED_VERTICAL_BAR_TYPE) ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL); else ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL); break; case ChartConfig.LINE_TYPE: renderer = (ds instanceof ItemPaintCategoryDataset) ? new LineAndShapeRenderer(true, false) { public Paint getItemPaint(int row, int column) { Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column); if (p != null) return p; else return getSeriesPaint(row); } } : (new LineAndShapeRenderer(true, false)); plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis, (CategoryItemRenderer) renderer); ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL); break; case ChartConfig.AREA_TYPE: renderer = (ds instanceof ItemPaintCategoryDataset) ? new AreaRenderer() { public Paint getItemPaint(int row, int column) { Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column); if (p != null) return p; else return getSeriesPaint(row); } } : new AreaRenderer(); plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis, (CategoryItemRenderer) renderer); ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL); break; case ChartConfig.VERTICAL_BAR3D_TYPE: case ChartConfig.HORIZONTAL_BAR3D_TYPE: categoryAxis = new CategoryAxis3D(chartConfig.getCategoryTitle()); valueAxis = new NumberAxis3D(chartConfig.getSerieTitle()); renderer = (ds instanceof ItemPaintCategoryDataset) ? new BarRenderer3D() { public Paint getItemPaint(int row, int column) { Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column); if (p != null) return p; else return getSeriesPaint(row); } } : new BarRenderer3D(); plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis, (CategoryItemRenderer) renderer); if (chartConfig.getType() == ChartConfig.VERTICAL_BAR3D_TYPE) ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL); else ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL); break; case ChartConfig.STACKED_VERTICAL_BAR3D_TYPE: case ChartConfig.STACKED_HORIZONTAL_BAR3D_TYPE: categoryAxis = new CategoryAxis3D(chartConfig.getCategoryTitle()); valueAxis = new NumberAxis3D(chartConfig.getSerieTitle()); renderer = (ds instanceof ItemPaintCategoryDataset) ? new StackedBarRenderer3D() { public Paint getItemPaint(int row, int column) { Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column); if (p != null) return p; else return getSeriesPaint(row); } } : new StackedBarRenderer3D(); plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis, (CategoryItemRenderer) renderer); if (chartConfig.getType() == ChartConfig.STACKED_VERTICAL_BAR3D_TYPE) ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL); else ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL); break; case ChartConfig.PIE_TYPE: case ChartConfig.PIE3D_TYPE: categoryAxis = null; valueAxis = null; renderer = null; ExtendedPieDataset pds = (ExtendedPieDataset) ds; plot = chartConfig.getType() == ChartConfig.PIE_TYPE ? new PiePlot(pds) : new PiePlot3D(pds); PiePlot pp = (PiePlot) plot; pp.setLabelGenerator(new StandardPieSectionLabelGenerator()); for (int i = 0; i < pds.getItemCount(); i++) { Paint p = pds.getPaint(i); if (p != null) pp.setSectionPaint(i, p); pp.setExplodePercent(i, pds.getExplodePercent(i)); Paint paint = pds.getPaint(i); if (paint != null) pp.setSectionPaint(i, paint); } break; case ChartConfig.XY_LINE_TYPE: renderer = new XYLineAndShapeRenderer(true, false); plot = new XYPlot((XYDataset) ds, (ValueAxis) categoryAxis, (ValueAxis) valueAxis, (XYLineAndShapeRenderer) renderer); break; case ChartConfig.TIME_SERIES_TYPE: renderer = new XYLineAndShapeRenderer(true, false); plot = new XYPlot((XYDataset) ds, (DateAxis) categoryAxis, (ValueAxis) valueAxis, (XYLineAndShapeRenderer) renderer); break; default: throw new OXFException("Chart Type not supported"); } if (categoryAxis != null) { categoryAxis.setLabelPaint(chartConfig.getTitleColor()); categoryAxis.setTickLabelPaint(chartConfig.getTitleColor()); categoryAxis.setTickMarkPaint(chartConfig.getTitleColor()); if (categoryAxis instanceof RestrictedNumberAxis) { ((RestrictedNumberAxis) categoryAxis).setMaxTicks(chartConfig.getMaxNumOfLabels()); } if (categoryAxis instanceof CategoryAxis && chartConfig.getCategoryMargin() != 0) ((CategoryAxis) categoryAxis).setCategoryMargin(chartConfig.getCategoryMargin()); } if (valueAxis != null) { valueAxis.setLabelPaint(chartConfig.getTitleColor()); valueAxis.setTickLabelPaint(chartConfig.getTitleColor()); valueAxis.setTickMarkPaint(chartConfig.getTitleColor()); ((RestrictedNumberAxis) valueAxis).setMaxTicks(chartConfig.getMaxNumOfLabels()); } if (renderer != null) { if (renderer instanceof XYLineAndShapeRenderer) { ((XYLineAndShapeRenderer) renderer).setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); } else { ((CategoryItemRenderer) renderer) .setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); } if (renderer instanceof BarRenderer) ((BarRenderer) renderer).setItemMargin(chartConfig.getBarMargin()); int j = 0; for (Iterator i = chartConfig.getValueIterator(); i.hasNext();) { Value v = (Value) i.next(); renderer.setSeriesPaint(j, v.getColor()); j++; } } plot.setOutlinePaint(chartConfig.getTitleColor()); CustomLegend legend = chartConfig.getLegendConfig(); chart = new JFreeChart(chartConfig.getTitle(), TextTitle.DEFAULT_FONT, plot, false); if (legend.isVisible()) { legend.setSources(new LegendItemSource[] { plot }); chart.addLegend(legend); } chart.setBackgroundPaint(chartConfig.getBackgroundColor()); TextTitle textTitle = new TextTitle(chartConfig.getTitle(), TextTitle.DEFAULT_FONT, chartConfig.getTitleColor(), TextTitle.DEFAULT_POSITION, TextTitle.DEFAULT_HORIZONTAL_ALIGNMENT, TextTitle.DEFAULT_VERTICAL_ALIGNMENT, TextTitle.DEFAULT_PADDING); chart.setTitle(textTitle); return chart; }