/** * Sets a black border with the specified line widths. * * @param top the top border line width. * @param left the left border line width. * @param bottom the bottom border line width. * @param right the right border line width. */ public void setBorder(double top, double left, double bottom, double right) { setFrame(new BlockBorder(top, left, bottom, right)); }
/** * Sets a black border with the specified line widths. * * @param top the top border line width. * @param left the left border line width. * @param bottom the bottom border line width. * @param right the right border line width. */ public void setBorder(double top, double left, double bottom, double right) { setFrame(new BlockBorder(top, left, bottom, right)); }
legend.setItemFont(font); legend.setBackgroundPaint(Color.WHITE); legend.setFrame(new BlockBorder(Color.BLACK)); if (position.toLowerCase().equals("northoutside")) { legend.setPosition(RectangleEdge.TOP);
legend.setFrame(new BlockBorder()); legend.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legend);
private void setPlotMessage(String messageText) { chart.getXYPlot().clearAnnotations(); TextTitle tt = new TextTitle(messageText); tt.setTextAlignment(HorizontalAlignment.RIGHT); tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 50)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER); chart.getXYPlot().addAnnotation(message); }
private void setPlotMessage(String messageText) { chart.getXYPlot().clearAnnotations(); TextTitle tt = new TextTitle(messageText); tt.setTextAlignment(HorizontalAlignment.RIGHT); tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 50)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER); chart.getXYPlot().addAnnotation(message); }
tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 100)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM);
tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 100)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM);
legend.setFrame(new BlockBorder()); legend.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legend);
public JFreeChart createStackedBarChart(String title, XYDataset dataset) { DateAxis domainAxis = new DateAxis("Date"); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); NumberAxis rangeAxis = new NumberAxis("Hours"); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.10); // leave some space for item labels StackedXYBarRenderer renderer = new StackedXYBarRenderer(0.15); // StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(); renderer.setDrawBarOutline(false); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER)); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} : {1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0"))); XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(title, plot); chart.removeLegend(); chart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); LegendTitle legend = new LegendTitle(plot); legend.setBackgroundPaint(Color.white); legend.setFrame(new BlockBorder()); legend.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legend); return chart; }
void configureLegend(LegendTitle chartLegend) { if (chartLegend != null) { if (findColor(getLegendBackgroundPaint()) != null) { chartLegend.setBackgroundPaint(findColor(getLegendBackgroundPaint())); } if (findColor(getLegendOutlinePaint()) != null) { chartLegend.setFrame(new BlockBorder(findColor(getLegendOutlinePaint()))); } if (findColor(getLegendItemPaint()) != null) { chartLegend.setItemPaint(findColor(getLegendItemPaint())); } } }
lt.setItemFont(new Font("Dialog", Font.PLAIN, 9)); lt.setBackgroundPaint(new Color(200, 200, 255, 100)); lt.setFrame(new BlockBorder(Color.white)); lt.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation ta = new XYTitleAnnotation(0.98, 0.02, lt,
public JFreeChart createStackedAreaChart(String title, TableXYDataset dataset) { DateAxis domainAxis = new DateAxis("Date"); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); NumberAxis rangeAxis = new NumberAxis("Minutes"); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.10); StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER)); renderer.setSeriesPaint(0, Color.lightGray); XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); plot.setRenderer(0, renderer); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); LegendTitle legend = new LegendTitle(plot); legend.setBackgroundPaint(Color.white); legend.setFrame(new BlockBorder()); legend.setPosition(RectangleEdge.BOTTOM); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.removeLegend(); chart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); chart.addSubtitle(legend); return chart; }
legend.setAxisOffset(5.0); legend.setMargin(new RectangleInsets(5, 5, 5, 5)); legend.setFrame(new BlockBorder(Color.red)); legend.setPadding(new RectangleInsets(10, 10, 10, 10)); legend.setStripWidth(10);