/** * Adds a legend to the plot and sends a {@link ChartChangeEvent} to all * registered listeners. * * @param legend the legend ({@code null} not permitted). * * @see #removeLegend() */ public void addLegend(LegendTitle legend) { addSubtitle(legend); }
/** * Adds a legend to the plot and sends a {@link ChartChangeEvent} to all * registered listeners. * * @param legend the legend (<code>null</code> not permitted). * * @see #removeLegend() */ public void addLegend(LegendTitle legend) { addSubtitle(legend); }
/** * Adds a subtitle to the chart. * * @param subtitle the subtitle. */ public void addSubtitle(Title subtitle) { this.chart.addSubtitle(subtitle); }
private void createChart(XYPlot plot, String fileName, String caption) throws IOException { JFreeChart chart = new JFreeChart(caption, plot); chart.addSubtitle(this.subtitle); if (plot.getRangeAxis() instanceof LogarithmicAxis) { chart.addSubtitle(1, new TextTitle("(logarithmische Skala)")); } File file = new File(fileName); file.delete(); ChartUtilities.saveChartAsPNG(file, chart, CHART_WIDTH, CHART_HEIGHT); }
/** * Adds a subtitle to the chart. * * @param subtitle the subtitle. */ public void addSubtitle(String subtitle) { this.chart.addSubtitle(new TextTitle(subtitle)); }
/** * Adds a subtitle to the chart. * * @param subtitle the subtitle. * @param font the subtitle font. */ public void addSubtitle(String subtitle, Font font) { this.chart.addSubtitle(new TextTitle(subtitle, font)); }
public void setSubTitle( String title ) { chart.addSubtitle(new TextTitle(title,new Font("SansSerif", Font.ITALIC, 12))); }
/** * Adds the MATSim Logo in the lower right corner of the chart. */ public void addMatsimLogo() { try { Image image = MatsimResource.getAsImage("matsim_logo_transparent_small.png"); Title subtitle = new ImageTitle(image, RectangleEdge.BOTTOM, HorizontalAlignment.RIGHT, VerticalAlignment.BOTTOM); this.chart.addSubtitle(subtitle); } catch ( Exception e ) { e.printStackTrace() ; // I just had a resource-not-found error inside the method; don't know what that means but does not feel like a reason // to not continue. kai, apr'30 } }
public MemoryRelativeBarPlot( String title ) { chart = ChartFactory.createBarChart( title, // chart title "Operation", // domain axis label "Relative Memory", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); chart.addSubtitle(new TextTitle("(Smaller is Better)",new Font("SansSerif", Font.ITALIC, 12))); plot(); }
/** * @param chartConfig * @param barChart */ private static void addSubTitles(BarChart chartConfig, JFreeChart barChart) { Iterator<SubTitle> it; /* * Add subtitles. */ for (it = chartConfig.getSubTitleCollection().iterator(); it.hasNext();) { SubTitle subTitle = (SubTitle) it.next(); Title title = subTitle.getTitle(); String value = title.getValue(); barChart.addSubtitle(new TextTitle(value)); } }
/** * Sets the title list for the chart (completely replaces any existing * titles) and sends a {@link ChartChangeEvent} to all registered * listeners. * * @param subtitles the new list of subtitles (<code>null</code> not * permitted). * * @see #getSubtitles() */ public void setSubtitles(List subtitles) { if (subtitles == null) { throw new NullPointerException("Null 'subtitles' argument."); } setNotify(false); clearSubtitles(); Iterator iterator = subtitles.iterator(); while (iterator.hasNext()) { Title t = (Title) iterator.next(); if (t != null) { addSubtitle(t); } } setNotify(true); // this fires a ChartChangeEvent }
/** * @param chartConfig * @param barChart */ private static void addSubTitles(BarChart chartConfig, JFreeChart barChart) { Iterator<SubTitle> it; /* * Add subtitles. */ for (it = chartConfig.getSubTitleCollection().iterator(); it.hasNext();) { SubTitle subTitle = (SubTitle) it.next(); Title title = subTitle.getTitle(); String value = title.getValue(); barChart.addSubtitle(new TextTitle(value)); } }
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); }
compositeTitle.setVerticalAlignment(VerticalAlignment.CENTER); chart.getTitle().setVisible(false); chart.addSubtitle(compositeTitle);
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; }
/** * Sets the title list for the chart (completely replaces any existing * titles) and sends a {@link ChartChangeEvent} to all registered * listeners. * * @param subtitles the new list of subtitles ({@code null} not * permitted). * * @see #getSubtitles() */ public void setSubtitles(List<Title> subtitles) { Args.nullNotPermitted(subtitles, "subtitles"); setNotify(false); clearSubtitles(); for (Title t: subtitles) { if (t != null) { addSubtitle(t); } } setNotify(true); // this fires a ChartChangeEvent }
private void addNotice(JFreeChart chart) { TextTitle notice = new TextTitle(); String msg = i18n.get("msg.io.chart.notice"); if (msg != null && !msg.isEmpty()) { notice.setText(msg); notice.setPaint(Color.BLACK); notice.setFont(LabelConstants.FONT_LABEL_SMALL); notice.setPosition(RectangleEdge.BOTTOM); notice.setHorizontalAlignment(HorizontalAlignment.RIGHT); notice.setVerticalAlignment(VerticalAlignment.BOTTOM); notice.setPadding(new RectangleInsets(0, 0, 20, 20)); chart.addSubtitle(notice); } }
private void addNotice(JFreeChart chart) { TextTitle notice = new TextTitle(); String msg = i18n.get("notice"); if (msg != null && !msg.isEmpty()) { notice.setText(msg); notice.setPaint(BLACK); notice.setFont(FONT_LABEL_SMALL); notice.setPosition(RectangleEdge.BOTTOM); notice.setHorizontalAlignment(HorizontalAlignment.RIGHT); notice.setVerticalAlignment(VerticalAlignment.BOTTOM); notice.setPadding(new RectangleInsets(0, 0, 20, 20)); chart.addSubtitle(notice); } }
/** * Sets basic configuration including title font, subtitle, background paint and * anti-alias on the given JFreeChart. */ private void setBasicConfig( JFreeChart jFreeChart, BaseChart chart) { jFreeChart.getTitle().setFont( TITLE_FONT ); jFreeChart.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR ); jFreeChart.setAntiAlias( true ); if ( !chart.isHideTitle() ) { jFreeChart.addSubtitle( getSubTitle( chart ) ); } Plot plot = jFreeChart.getPlot(); plot.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR ); plot.setOutlinePaint( DEFAULT_BACKGROUND_COLOR ); }
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; }