Refine search
true, // tooltips false ); // urls chart.setBackgroundPaint( Color.white ); TextTitle title = new TextTitle( chartTitle ); title.setFont( new java.awt.Font( "SansSerif", java.awt.Font.BOLD, 12 ) ); chart.setTitle( title ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint( Color.white ); plot.setForegroundAlpha( 0.5f );
public static JFreeChart createJFreeChart(String title, XYPlot result, int imageHeight) { JFreeChart chart = new JFreeChart(title, result); chart.getLegend().setPosition(RectangleEdge.TOP); chart.getLegend().setHorizontalAlignment(HorizontalAlignment.LEFT); chart.getLegend().setFrame(BlockBorder.NONE); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, imageHeight, new Color(229, 236, 246))); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN | Font.BOLD, 16)); chart.getTitle().setPaint(Color.GRAY); return chart; } }
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); }
public static void setupTextTitle(TextTitle title) { if (title != null) { title.setFont(ChartDefaults.titleFont); title.setTextAlignment(HorizontalAlignment.LEFT); title.setPaint(ChartDefaults.titleTextColor); title.setBackgroundPaint(ChartDefaults.transparent); } }
TextTitle legendText = new TextTitle("This is LEGEND: "); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText);
/** * Creates a new plot. * * @param dataset the dataset ({@code null} permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); setDataset(dataset); PiePlot piePlot = new PiePlot(null); piePlot.setIgnoreNullValues(true); this.pieChart = new JFreeChart(piePlot); this.pieChart.removeLegend(); this.dataExtractOrder = TableOrder.BY_COLUMN; this.pieChart.setBackgroundPaint(null); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); this.pieChart.setTitle(seriesTitle); this.aggregatedItemsKey = "Other"; this.aggregatedItemsPaint = Color.lightGray; this.sectionPaints = new HashMap(); this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0); }
public static void increaseFontSize(JFreeChart chart, int amount) XYPlot plot = chart.getXYPlot(); int size = font.getSize(); size += amount; Font bigger = new Font(font.getName(), font.getStyle(), size); ValueAxis valueAxis = plot.getDomainAxis(); valueAxis.setTickLabelFont(bigger); font = chart.getTitle().getFont(); size = font.getSize(); size += amount; bigger = new Font(font.getName(), font.getStyle(), size); chart.getTitle().setFont(bigger); if ( chart.getLegend() != null ) font = chart.getLegend().getItemFont(); size = font.getSize(); size += amount; bigger = new Font(font.getName(), font.getStyle(), size); chart.getLegend().setItemFont(bigger);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); TextTitle subtitle = new TextTitle("Bright " + (greenForIncrease ? "red" : "green") + "=change >=-" + percentDiffForMaxScale + "%, Bright " + (!greenForIncrease ? "red" : "green") + "=change >=+" + percentDiffForMaxScale + "%", new Font("SansSerif", Font.PLAIN, 10)); chart.addSubtitle(subtitle);
PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(java.awt.Color.white); chart.setTitle(new TextTitle(plotTitle, new Font("SansSerif", Font.BOLD, 12)));
public void setSubTitle( String title ) { chart.addSubtitle(new TextTitle(title,new Font("SansSerif", Font.ITALIC, 12))); }
lineChart.getTitle().setFont(new Font("Ubuntu", Font.PLAIN, 20)); lineChart.getPlot().setOutlineStroke(new BasicStroke(3)); lineChart.getCategoryPlot().getRenderer().setSeriesStroke(0, new BasicStroke(3)); lineChart.getCategoryPlot().getRenderer().setSeriesStroke(1, new BasicStroke(3));
final TextTitle copyright = new TextTitle("QALab 2004+,ObjectLab.co.uk Generated " + QALabTags.DEFAULT_DATETIME_FORMAT.format(new Date()), new Font("SansSerif", Font.PLAIN, DEFAULT_FONT_SIZE)); copyright.setPosition(RectangleEdge.BOTTOM); copyright.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(copyright); chart.setBackgroundImage(getLogo()); chart.setBackgroundImageAlpha(ALPHA); chart.setBackgroundImageAlignment(Align.BOTTOM_LEFT); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, MAX_WIDTH, Color.blue));
chart.setBackgroundPaint(Color.white); chart.addSubtitle(new TextTitle(ConfigurationContext.COPYRIGHT, new Font(LABEL_FONT, Font.PLAIN, 9), Color.black, RectangleEdge.BOTTOM, HorizontalAlignment.RIGHT, VerticalAlignment.BOTTOM, new RectangleInsets(0, 0, 20, 20))); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray);
private void setUpVisuals() graph.getXYPlot().setDomainGridlinePaint(Color.BLACK); graph.getXYPlot().setDomainGridlinesVisible(false); graph.getXYPlot().setDomainGridlineStroke(new BasicStroke(3f)); graph.getXYPlot().setRangeGridlinePaint(Color.BLACK); graph.getTitle().setFont(new Font("SansSerif", Font.BOLD, 26)); graph.getXYPlot().getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 20)); graph.getXYPlot().getRangeAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 20)); graph.getXYPlot().getDomainAxis().setLabelFont(new Font("SansSerif", Font.BOLD, 22)); graph.getXYPlot().getRangeAxis().setLabelFont(new Font("SansSerif", Font.BOLD, 22));
chart.setTitle(new TextTitle("XY Chart Sample, non default font", new java.awt.Font("Serif", Font.BOLD, 12))); chart.setBackgroundPaint(Color.white); chart.setBorderPaint(Color.black); chart.setBorderStroke(new BasicStroke(1)); chart.setBorderVisible(true);
public JFreeChart createChart() { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart( title, "Matrix Libraries", "Relative Performance", dataSet, true); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); plot.setBackgroundPaint(new Color(230,230,230)); plot.setDomainGridlinePaint(new Color(50,50,50,50)); plot.setDomainGridlineStroke(new BasicStroke(78f)); chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24)); String foo = "( Higher is Better )"; if( subtitle != null ) foo += " ( "+subtitle+" )"; chart.addSubtitle(new TextTitle(foo,new Font("SansSerif", Font.ITALIC, 12))); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
public OverallRelativeAreaPlot(String title , int sizes[] ) { // createAreaChart chart = ChartFactory.createStackedAreaChart( title, // chart title "Size", // domain axis label "Relative Average Speed", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false ); chart.addSubtitle(new TextTitle("Weighted by Operation Speed. Larger is Better.",new Font("SansSerif", Font.ITALIC, 12))); plot = chart.getCategoryPlot(); sizeNames = new String[sizes.length]; for( int i = 0; i < sizes.length; i++ ) { sizeNames[i] = Integer.toString(sizes[i]); } plot.setRangeGridlinePaint(Color.WHITE); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinesVisible(true); }
chart.getPlot().setOutlineVisible(false); if (chart.getPlot() instanceof XYPlot) { XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setLabelFont(font); plot.getDomainAxis().setTickLabelFont(font); Font newFont = oldFont.deriveFont((float) fontSize); axis.setTickLabelFont(newFont); TextTitle t = new TextTitle(s[i].replace('+', ' ')); t.setPaint(Color.gray); t.setFont(font.deriveFont(font.getSize2D() * 14f / 12f)); chart.addSubtitle(t); if (t instanceof TextTitle) { TextTitle tt = (TextTitle) t; tt.setPaint(color); tt.setFont(font.deriveFont((float) size)); LegendTitle legend = new LegendTitle(chart.getPlot()); RectangleEdge pos = RectangleEdge.RIGHT; String[] chdlp = (String[]) params.get("chdlp");
chart.getTitle().setFont(FONT); chart.getLegend().setItemFont(SMALL_FONT); XYPlot plot = chart.getXYPlot();
jfreeChart.setBackgroundPaint(getChart().getBackcolor()); jfreeChart.setBackgroundPaint(TRANSPARENT_PAINT); if (jfreeChart.getTitle() != null) TextTitle title = jfreeChart.getTitle(); title.setPaint(getChart().getTitleColor()); title.setFont(JRFontUtil.getAwtFont(getChart().getTitleFont(), getLocale())); title.setPosition(titleEdge); if (subtitleText != null) TextTitle subtitle = new TextTitle(subtitleText); subtitle.setPaint(getChart().getSubtitleColor()); subtitle.setFont(JRFontUtil.getAwtFont(getChart().getSubtitleFont(), getLocale())); subtitle.setPosition(titleEdge); jfreeChart.addSubtitle(subtitle); if (legend != null) legend.setItemPaint(getChart().getLegendColor()); legend.setBackgroundPaint(TRANSPARENT_PAINT);