List of usage examples for org.jfree.ui TextAnchor BASELINE_LEFT
TextAnchor BASELINE_LEFT
To view the source code for org.jfree.ui TextAnchor BASELINE_LEFT.
Click Source Link
From source file:org.jfree.chart.demo.BarChart3DDemo4.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart3D("Student Grades", "Students", "Grade", categorydataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); CustomBarRenderer3D custombarrenderer3d = new CustomBarRenderer3D(); custombarrenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); custombarrenderer3d.setBaseItemLabelsVisible(true); custombarrenderer3d.setItemLabelAnchorOffset(10D); custombarrenderer3d.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); categoryplot.setRenderer(custombarrenderer3d); ValueMarker valuemarker = new ValueMarker(0.69999999999999996D, new Color(200, 200, 255), new BasicStroke(1.0F), new Color(200, 200, 255), new BasicStroke(1.0F), 1.0F); categoryplot.addRangeMarker(valuemarker, Layer.BACKGROUND); custombarrenderer3d.setBaseItemLabelsVisible(true); custombarrenderer3d.setMaximumBarWidth(0.050000000000000003D); CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation("Minimum grade to pass", "Robert", 0.70999999999999996D); categorytextannotation.setCategoryAnchor(CategoryAnchor.START); categorytextannotation.setFont(new Font("SansSerif", 0, 12)); categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); categoryplot.addAnnotation(categorytextannotation); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance()); numberaxis.setUpperMargin(0.10000000000000001D); return jfreechart; }
From source file:net.sf.dynamicreports.design.transformation.chartcustomizer.ShowValuesCustomizer.java
@Override public void customize(JFreeChart chart, ReportParameters reportParameters) { if (chart.getPlot() instanceof CategoryPlot) { CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer(); if (StringUtils.isBlank(valuePattern)) { renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); } else {/*from w w w . jav a 2 s . c om*/ renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, new DecimalFormat(valuePattern))); } renderer.setBaseItemLabelsVisible(Boolean.TRUE); chart.getCategoryPlot().getRangeAxis().zoomRange(0, 1.1); if (renderer.getClass().equals(BarRenderer3D.class)) { ((BarRenderer3D) renderer).setItemLabelAnchorOffset(10D); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); } } else if (chart.getPlot() instanceof XYPlot) { XYItemRenderer renderer = chart.getXYPlot().getRenderer(); if (StringUtils.isBlank(valuePattern)) { renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); } else { renderer.setBaseItemLabelGenerator( new StandardXYItemLabelGenerator(StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT, NumberFormat.getNumberInstance(), new DecimalFormat(valuePattern))); } renderer.setBaseItemLabelsVisible(Boolean.TRUE); chart.getXYPlot().getRangeAxis().zoomRange(0, 1.1); } }
From source file:Demo.LineGraph.java
private void InitChart() { JFreeChart chart = ChartFactory.createLineChart("Yield", "sample NB", "Probability", dataSet, PlotOrientation.VERTICAL, false, false, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setNoDataMessage("no data"); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseItemLabelsVisible(true); renderer.setSeriesPaint(0, Color.BLUE); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true);/*from w w w . jav a 2 s. co m*/ renderer.setBaseItemLabelsVisible(true); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelFont(new Font("Times New Romain", 0, 10)); plot.setRenderer(renderer); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createDownRotationLabelPositions(Math.PI / 6.0)); chartPane = new ChartPanel(chart); }
From source file:fr.paris.lutece.plugins.form.business.GraphTypeBarChart.java
/** * return the JFreeChart BarChart graph//from w ww .j av a 2 s.co m * @param listStatistic listStatistic * @param strGraphTitle graph title * @param nGraphThreeDimension true if the graph must be in three dimension * @param nGraphLabelValue true if the labels must appear in the graph * @return the JFreeChart graph associate to the graph type */ //Cration de l'histogramme public static JFreeChart createBarChart(List<StatisticEntrySubmit> listStatistic, String strGraphTitle, boolean nGraphThreeDimension, boolean nGraphLabelValue) { JFreeChart chart; CategoryDataset dataset = createBarChartDataset(listStatistic); if (nGraphThreeDimension) { chart = ChartFactory.createBarChart3D(strGraphTitle, null, null, dataset, PlotOrientation.VERTICAL, true, false, false); } else { chart = ChartFactory.createBarChart(strGraphTitle, null, null, dataset, PlotOrientation.VERTICAL, true, false, false); } CategoryPlot categoryPlot = chart.getCategoryPlot(); CategoryAxis categoryAxis = categoryPlot.getDomainAxis(); CategoryLabelPositions labelPositions = CategoryLabelPositions.UP_45; categoryAxis.setCategoryLabelPositions(labelPositions); BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer(); if (nGraphLabelValue) { renderer.setItemLabelsVisible(true); DecimalFormat decimalformat1 = new DecimalFormat("#.#"); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1)); if (nGraphThreeDimension) { renderer.setPositiveItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.BASELINE_LEFT)); categoryPlot.setRenderer(renderer); } } return chart; }
From source file:net.sf.maltcms.chromaui.chromatogram2Dviewer.datastructures.annotations.Peak2DXMLAnnotationProvider.java
/** * * @param t//from w ww . j av a 2 s . co m * @return */ @Override public XYAnnotation create(Peak2D t) { Point seed = t.getPeakArea().getSeedPoint(); // PeakArea2D pa2D = t.getPeakArea(); Shape s = null; // if(pa2D==null) { s = new Rectangle2D.Double(seed.x - 1, seed.y - 1, 3, 3); // }else{ //List<Point> l = pa2D.getBoundaryPoints(); // } XYSelectableShapeAnnotation<Peak2D> xypa = new XYSelectableShapeAnnotation<>(seed.x, seed.y, s, t.getName(), TextAnchor.BASELINE_LEFT, t); return xypa; }
From source file:inflor.core.plots.FCSChartPanel.java
public void createGateAnnotation(XYGateAnnotation annotation) { AbstractGate gate = ChartUtils.createGate(annotation); BitSet mask = gate.evaluate(data, transformSet); String result = BitSetUtils.frequencyOfParent(mask, 2); double[] position = estimateGateLabelPosition(annotation); XYTextAnnotation label = new XYTextAnnotation(annotation.getSubsetName() + ": " + result, position[0], position[1]);/*w w w . ja v a 2s . c o m*/ label.setTextAnchor(TextAnchor.BASELINE_LEFT); label.setFont(new Font("Arial", Font.BOLD, 14)); gateAnnotations.put(annotation, label); getChart().getXYPlot().addAnnotation(annotation, true); getChart().getXYPlot().addAnnotation(label); }
From source file:com.bdb.weather.display.day.DayTemperaturePane.java
@Override public void addExtremeMarkers(XYPlot plot, DailyRecords records, WeatherAverage averages) { if (minMaxLabelsItem.isSelected()) { String unit = Temperature.getDefaultUnit().toString(); if (records != null) { recordHigh = records.getMaxHighTemperature(); ValueMarker marker = new ValueMarker(recordHigh.get()); marker.setLabel("Record High " + recordHigh.toString() + " " + unit + " (" + records.getMaxHighTemperatureYear() + ")"); marker.setLabelTextAnchor(TextAnchor.BASELINE_LEFT); marker.setPaint(//from www .jav a 2 s . com StageUtilities.toAwtColor(ColorPreferences.getInstance().getHighOutdoorTempColorPref())); plot.addRangeMarker(marker); recordLow = records.getMinLowTemperature(); marker = new ValueMarker(recordLow.get()); marker.setLabel("Record Low " + recordLow.toString() + " " + unit + " (" + records.getMinLowTemperatureYear() + ")"); marker.setLabelTextAnchor(TextAnchor.BASELINE_LEFT); marker.setPaint( StageUtilities.toAwtColor(ColorPreferences.getInstance().getLowOutdoorTempColorPref())); plot.addRangeMarker(marker); } if (averages != null) { Temperature value = averages.getHighTemperature(); ValueMarker marker = new ValueMarker(value.get()); marker.setLabel("Average High " + value.toString() + " " + unit); marker.setLabelTextAnchor(TextAnchor.BASELINE_LEFT); marker.setPaint( StageUtilities.toAwtColor(ColorPreferences.getInstance().getHighOutdoorTempColorPref())); plot.addRangeMarker(marker); value = averages.getLowTemperature(); marker = new ValueMarker(value.get()); marker.setLabel("Average Low " + value.toString() + " " + unit); marker.setLabelTextAnchor(TextAnchor.BASELINE_LEFT); marker.setPaint( StageUtilities.toAwtColor(ColorPreferences.getInstance().getLowOutdoorTempColorPref())); plot.addRangeMarker(marker); } } }
From source file:org.jfree.chart.demo.DrawStringDemo.java
private TextAnchor convertStringToAnchor(String s) { if (s.equals("TextAnchor.TOP_LEFT")) return TextAnchor.TOP_LEFT; if (s.equals("TextAnchor.TOP_CENTER")) return TextAnchor.TOP_CENTER; if (s.equals("TextAnchor.TOP_RIGHT")) return TextAnchor.TOP_RIGHT; if (s.equals("TextAnchor.CENTER_LEFT")) return TextAnchor.CENTER_LEFT; if (s.equals("TextAnchor.CENTER")) return TextAnchor.CENTER; if (s.equals("TextAnchor.CENTER_RIGHT")) return TextAnchor.CENTER_RIGHT; if (s.equals("TextAnchor.HALF_ASCENT_LEFT")) return TextAnchor.HALF_ASCENT_LEFT; if (s.equals("TextAnchor.HALF_ASCENT_CENTER")) return TextAnchor.HALF_ASCENT_CENTER; if (s.equals("TextAnchor.HALF_ASCENT_RIGHT")) return TextAnchor.HALF_ASCENT_RIGHT; if (s.equals("TextAnchor.BASELINE_LEFT")) return TextAnchor.BASELINE_LEFT; if (s.equals("TextAnchor.BASELINE_CENTER")) return TextAnchor.BASELINE_CENTER; if (s.equals("TextAnchor.BASELINE_RIGHT")) return TextAnchor.BASELINE_RIGHT; if (s.equals("TextAnchor.BOTTOM_LEFT")) return TextAnchor.BOTTOM_LEFT; if (s.equals("TextAnchor.BOTTOM_CENTER")) return TextAnchor.BOTTOM_CENTER; if (s.equals("TextAnchor.BOTTOM_RIGHT")) return TextAnchor.BOTTOM_RIGHT; else//from w ww.j ava 2s .c om return null; }
From source file:com.manydesigns.portofino.chart.ChartBarGenerator.java
public JFreeChart generate(ChartDefinition chartDefinition, Persistence persistence, Locale locale) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); java.util.List<Object[]> result; String query = chartDefinition.getQuery(); logger.info(query);/* ww w .ja v a2s . c o m*/ Session session = persistence.getSession(chartDefinition.getDatabase()); result = QueryUtils.runSql(session, query); for (Object[] current : result) { ComparableWrapper x = new ComparableWrapper((Comparable) current[0]); ComparableWrapper y = new ComparableWrapper((Comparable) current[1]); if (current.length > 3) { x.setLabel(current[3].toString()); } if (current.length > 4) { y.setLabel(current[4].toString()); } dataset.setValue((Number) current[2], x, y); } PlotOrientation plotOrientation = PlotOrientation.HORIZONTAL; if (chartDefinition.getActualOrientation() == ChartDefinition.Orientation.VERTICAL) { plotOrientation = PlotOrientation.VERTICAL; } JFreeChart chart = createChart(chartDefinition, dataset, plotOrientation); chart.setAntiAlias(antiAlias); // impostiamo il bordo invisibile // eventualmente e' il css a fornirne uno chart.setBorderVisible(borderVisible); // impostiamo il titolo TextTitle title = chart.getTitle(); title.setFont(titleFont); title.setMargin(10.0, 0.0, 0.0, 0.0); // ottieni il Plot CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); String urlExpression = chartDefinition.getUrlExpression(); if (!StringUtils.isBlank(urlExpression)) { CategoryURLGenerator urlGenerator = new ChartBarUrlGenerator(chartDefinition.getUrlExpression()); renderer.setBaseItemURLGenerator(urlGenerator); } else { renderer.setBaseItemURLGenerator(null); } renderer.setBaseOutlinePaint(Color.BLACK); // /////////////// if (renderer instanceof BarRenderer || renderer instanceof BarRenderer3D) { BarRenderer barRenderer = (BarRenderer) renderer; barRenderer.setDrawBarOutline(true); barRenderer.setShadowVisible(false); barRenderer.setBarPainter(new StandardBarPainter()); // hongliangpan add barRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); barRenderer.setBaseItemLabelsVisible(true); // ? setSeriesItemLabelGenerator barRenderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); // bar??? barRenderer.setMinimumBarLength(0.02); // barRenderer.setMaximumBarWidth(0.05); // ????? // ??90,??/3.14 ItemLabelPosition itemLabelPositionFallback = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT, TextAnchor.HALF_ASCENT_LEFT, -1.57D); // ??labelposition // barRenderer.setPositiveItemLabelPositionFallback(itemLabelPositionFallback); // barRenderer.setNegativeItemLabelPositionFallback(itemLabelPositionFallback); barRenderer.setItemLabelsVisible(true); // ? barRenderer.setBaseOutlinePaint(Color.BLACK); // ??? barRenderer.setDrawBarOutline(true); // ??? barRenderer.setItemMargin(0.0); // ? barRenderer.setIncludeBaseInRange(true); barRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); barRenderer.setBaseItemLabelsVisible(true); // ? plot.setForegroundAlpha(1.0f); } // /////////////// // il plot ha sfondo e bordo trasparente // (quindi si vede il colore del chart) plot.setBackgroundPaint(transparentColor); plot.setOutlinePaint(transparentColor); // Modifico il toolTip // plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0} = {1} ({2})")); // imposta il messaggio se non ci sono dati plot.setNoDataMessage(ElementsThreadLocals.getText("no.data.available")); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.GRAY); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); // Category axis CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setAxisLinePaint(Color.BLACK); categoryAxis.setLabelFont(axisFont); categoryAxis.setAxisLineVisible(true); // impostiamo la rotazione dell'etichetta if (plot.getOrientation() == PlotOrientation.VERTICAL) { CategoryLabelPosition pos = new CategoryLabelPosition(RectangleAnchor.TOP_LEFT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -Math.PI / 4.0, CategoryLabelWidthType.CATEGORY, 100); CategoryLabelPositions positions = new CategoryLabelPositions(pos, pos, pos, pos); categoryAxis.setCategoryLabelPositions(positions); categoryAxis.setMaximumCategoryLabelWidthRatio(6.0f); height = 333; } else { categoryAxis.setMaximumCategoryLabelWidthRatio(0.4f); // recuperiamo 8 pixel a sinistra plot.setInsets(new RectangleInsets(4.0, 0.0, 4.0, 8.0)); height = 74; // contiamo gli elementi nel dataset height += 23 * dataset.getColumnCount(); height += 57; } Axis rangeAxis = plot.getRangeAxis(); rangeAxis.setAxisLinePaint(Color.BLACK); rangeAxis.setLabelFont(axisFont); DrawingSupplier supplier = new DesaturatedDrawingSupplier(plot.getDrawingSupplier()); plot.setDrawingSupplier(supplier); // impostiamo il titolo della legenda String legendString = chartDefinition.getLegend(); Title subtitle = new TextTitle(legendString, legendFont, Color.BLACK, RectangleEdge.BOTTOM, HorizontalAlignment.CENTER, VerticalAlignment.CENTER, new RectangleInsets(0, 0, 0, 0)); subtitle.setMargin(0, 0, 5, 0); chart.addSubtitle(subtitle); // impostiamo la legenda LegendTitle legend = chart.getLegend(); legend.setBorder(0, 0, 0, 0); legend.setItemFont(legendItemFont); int legendMargin = 10; legend.setMargin(0.0, legendMargin, legendMargin, legendMargin); legend.setBackgroundPaint(transparentColor); // impostiamo un gradiente orizzontale Paint chartBgPaint = new GradientPaint(0, 0, new Color(255, 253, 240), 0, height, Color.WHITE); chart.setBackgroundPaint(chartBgPaint); return chart; }
From source file:com.manydesigns.portofino.chart.ChartStackedBarGenerator.java
public JFreeChart generate(ChartDefinition chartDefinition, Persistence persistence, Locale locale) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); java.util.List<Object[]> result; String query = chartDefinition.getQuery(); logger.info(query);/*from ww w .j a v a 2 s .com*/ Session session = persistence.getSession(chartDefinition.getDatabase()); result = QueryUtils.runSql(session, query); for (Object[] current : result) { ComparableWrapper x = new ComparableWrapper((Comparable) current[0]); ComparableWrapper y = new ComparableWrapper((Comparable) current[1]); if (current.length > 3) { x.setLabel(current[3].toString()); } if (current.length > 4) { y.setLabel(current[4].toString()); } dataset.setValue((Number) current[2], x, y); } PlotOrientation plotOrientation = PlotOrientation.HORIZONTAL; if (chartDefinition.getActualOrientation() == ChartDefinition.Orientation.VERTICAL) { plotOrientation = PlotOrientation.VERTICAL; } JFreeChart chart = createChart(chartDefinition, dataset, plotOrientation); chart.setAntiAlias(antiAlias); // impostiamo il bordo invisibile // eventualmente e' il css a fornirne uno chart.setBorderVisible(borderVisible); // impostiamo il titolo TextTitle title = chart.getTitle(); title.setFont(titleFont); title.setMargin(10.0, 0.0, 0.0, 0.0); // ottieni il Plot CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); String urlExpression = chartDefinition.getUrlExpression(); if (!StringUtils.isBlank(urlExpression)) { CategoryURLGenerator urlGenerator = new ChartBarUrlGenerator(chartDefinition.getUrlExpression()); renderer.setBaseItemURLGenerator(urlGenerator); } else { renderer.setBaseItemURLGenerator(null); } renderer.setBaseOutlinePaint(Color.BLACK); // /////////////// if (renderer instanceof BarRenderer) { BarRenderer barRenderer = (BarRenderer) renderer; barRenderer.setDrawBarOutline(true); barRenderer.setShadowVisible(false); barRenderer.setBarPainter(new StandardBarPainter()); // hongliangpan add // ? barRenderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); // bar??? barRenderer.setMinimumBarLength(0.02); // barRenderer.setMaximumBarWidth(0.06); } if (renderer instanceof StackedBarRenderer3D || renderer instanceof StackedBarRenderer) { BarRenderer barRenderer = (BarRenderer) renderer; barRenderer.setDrawBarOutline(true); barRenderer.setShadowVisible(false); barRenderer.setBarPainter(new StandardBarPainter()); // hongliangpan add // ? setSeriesItemLabelGenerator barRenderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); // bar??? barRenderer.setMinimumBarLength(0.02); // barRenderer.setMaximumBarWidth(0.06); // ????? ItemLabelPosition itemLabelPositionFallback = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT, TextAnchor.HALF_ASCENT_LEFT, -1.57D); // ??labelposition barRenderer.setPositiveItemLabelPositionFallback(itemLabelPositionFallback); barRenderer.setNegativeItemLabelPositionFallback(itemLabelPositionFallback); barRenderer.setItemLabelsVisible(true); barRenderer.setItemMargin(10); } // /////////////// // il plot ha sfondo e bordo trasparente // (quindi si vede il colore del chart) plot.setBackgroundPaint(transparentColor); plot.setOutlinePaint(transparentColor); // Modifico il toolTip // plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0} = {1} ({2})")); // imposta il messaggio se non ci sono dati plot.setNoDataMessage(ElementsThreadLocals.getText("no.data.available")); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.GRAY); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); // Category axis CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setAxisLinePaint(Color.BLACK); categoryAxis.setLabelFont(axisFont); categoryAxis.setAxisLineVisible(true); // impostiamo la rotazione dell'etichetta if (plot.getOrientation() == PlotOrientation.VERTICAL) { CategoryLabelPosition pos = new CategoryLabelPosition(RectangleAnchor.TOP_LEFT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -Math.PI / 4.0, CategoryLabelWidthType.CATEGORY, 100); CategoryLabelPositions positions = new CategoryLabelPositions(pos, pos, pos, pos); categoryAxis.setCategoryLabelPositions(positions); categoryAxis.setMaximumCategoryLabelWidthRatio(6.0f); height = 333; } else { categoryAxis.setMaximumCategoryLabelWidthRatio(0.4f); // recuperiamo 8 pixel a sinistra plot.setInsets(new RectangleInsets(4.0, 0.0, 4.0, 8.0)); height = 74; // contiamo gli elementi nel dataset height += 23 * dataset.getColumnCount(); height += 57; } Axis rangeAxis = plot.getRangeAxis(); rangeAxis.setAxisLinePaint(Color.BLACK); rangeAxis.setLabelFont(axisFont); DrawingSupplier supplier = new DesaturatedDrawingSupplier(plot.getDrawingSupplier()); plot.setDrawingSupplier(supplier); // impostiamo il titolo della legenda String legendString = chartDefinition.getLegend(); Title subtitle = new TextTitle(legendString, legendFont, Color.BLACK, RectangleEdge.BOTTOM, HorizontalAlignment.CENTER, VerticalAlignment.CENTER, new RectangleInsets(0, 0, 0, 0)); subtitle.setMargin(0, 0, 5, 0); chart.addSubtitle(subtitle); // impostiamo la legenda LegendTitle legend = chart.getLegend(); legend.setBorder(0, 0, 0, 0); legend.setItemFont(legendItemFont); int legendMargin = 10; legend.setMargin(0.0, legendMargin, legendMargin, legendMargin); legend.setBackgroundPaint(transparentColor); // impostiamo un gradiente orizzontale Paint chartBgPaint = new GradientPaint(0, 0, new Color(255, 253, 240), 0, height, Color.WHITE); chart.setBackgroundPaint(chartBgPaint); return chart; }