CheckExists(); legend.setItemFont(font); legend.setBackgroundPaint(Color.WHITE); legend.setFrame(new BlockBorder(Color.BLACK)); if (position.toLowerCase().equals("northoutside")) {
/** * Creates a legend for the specified plot. * * @param plot The plot. * @return The legend for the plot. */ private LegendTitle createLegend(Plot plot) { LegendTitle legend = new LegendTitle(plot); legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); legend.setFrame(new LineBorder()); legend.setBackgroundPaint(Color.white); legend.setPosition(RectangleEdge.BOTTOM); return legend; }
legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); legend.setFrame(new LineBorder()); legend.setBackgroundPaint(Color.white); legend.setPosition(RectangleEdge.BOTTOM); this.subtitles.add(legend);
LegendTitle legend = new LegendTitle(this.plot); legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); legend.setBackgroundPaint(Color.WHITE); legend.setPosition(RectangleEdge.BOTTOM); this.subtitles.add(legend);
LegendTitle lt = (LegendTitle) title; if (lt.getBackgroundPaint() != null) { lt.setBackgroundPaint(this.legendBackgroundPaint);
LegendTitle lt = (LegendTitle) title; if (lt.getBackgroundPaint() != null) { lt.setBackgroundPaint(this.legendBackgroundPaint);
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.setBackgroundPaint(new Color(200, 200, 255, 100)); lt.setFrame(new BlockBorder(Color.white)); lt.setPosition(RectangleEdge.BOTTOM);
int legendMargin = 10; legend.setMargin(0.0, legendMargin, legendMargin, legendMargin); legend.setBackgroundPaint(transparentColor);
public static void customizeLegend(LegendTitle legend, ChartParams params) legend.setBackgroundPaint(params.getColor(ChartParams.LEGEND_BACKGROUND_COLOR));
int legendMargin = 10; legend.setMargin(0.0, legendMargin, legendMargin, legendMargin); legend.setBackgroundPaint(transparentColor);
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.setBackgroundPaint(TRANSPARENT_PAINT); legend.setBackgroundPaint(getChart().getLegendBackgroundColor());
chart.getLegend().setBackgroundPaint(background); chart.getLegend().setItemPaint(foregroung);