Java Code Examples for org.jfree.chart.title.TextTitle

The following are top voted examples for showing how to use org.jfree.chart.title.TextTitle. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: jfree-fxdemos   File: BarChartFXDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 2
Project: Proyecto-DASI   File: BarChartDemo1.java   View source code 6 votes vote down vote up
/**
     * Creates a sample chart.
     *
     * @param dataset  the dataset.
     *
     * @return The chart.
     */
    private static JFreeChart createChart(CategoryDataset dataset) {
        JFreeChart chart = ChartFactory.createBarChart(
            "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
                "Milliseconds" /* y-axis label */, dataset, PlotOrientation.HORIZONTAL,false,false,false);
        chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
                + "format (lower bars = better performance)"));
        chart.setBackgroundPaint(Color.white);
        CategoryPlot plot = (CategoryPlot) chart.getPlot();

        // ******************************************************************
        //  More than 150 demo applications are included with the JFreeChart
        //  Developer Guide...for more information, see:
        //
        //  >   http://www.object-refinery.com/jfreechart/guide.html
        //
        // ******************************************************************

        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setDrawBarOutline(false);
//        chart.getLegend().setFrame(BlockBorder.NONE);
        return chart;
    }
 
Example 3
Project: parabuild-ci   File: JFreeChart.java   View source code 6 votes vote down vote up
/**
 * Sets the chart title.  This is a convenience method that ends up calling the 
 * {@link #setTitle(TextTitle)} method.
 *
 * @param title  the new title (<code>null</code> permitted).
 */
public void setTitle(String title) {

    if (title != null) {
        if (this.title == null) {
            setTitle(new TextTitle(title, JFreeChart.DEFAULT_TITLE_FONT));
        }
        else {
            this.title.setText(title);
        }
    }
    else {
        setTitle((TextTitle) null);
    }

}
 
Example 4
Project: parabuild-ci   File: TitleTests.java   View source code 6 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    
    // use the TextTitle class because it is a concrete subclass
    Title t1 = new TextTitle();
    Title t2 = new TextTitle();
    assertEquals(t1, t2);
    
    t1.setPosition(RectangleEdge.LEFT);
    assertFalse(t1.equals(t2));
    t2.setPosition(RectangleEdge.LEFT);
    assertTrue(t1.equals(t2));
    
    t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));
    
    t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertTrue(t1.equals(t2));
    
}
 
Example 5
Project: parabuild-ci   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 * 
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    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();
}
 
Example 6
Project: ccu-historian   File: XYTitleAnnotationTest.java   View source code 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    TextTitle t = new TextTitle("Title");
    XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t);
    XYTitleAnnotation a2 = new XYTitleAnnotation(1.0, 2.0, t);
    assertTrue(a1.equals(a2));
    
    a1 = new XYTitleAnnotation(1.1, 2.0, t);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.0, t);
    assertTrue(a1.equals(a2));

    a1 = new XYTitleAnnotation(1.1, 2.2, t);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.2, t);
    assertTrue(a1.equals(a2));
    
    TextTitle t2 = new TextTitle("Title 2");
    a1 = new XYTitleAnnotation(1.1, 2.2, t2);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.2, t2);
    assertTrue(a1.equals(a2));
}
 
Example 7
Project: ccu-historian   File: BarChartFXDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 8
Project: ccu-historian   File: BarChartDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 9
Project: ccu-historian   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> 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);
}
 
Example 10
Project: ccu-historian   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart (<code>null</code> not permitted).
 */
@Override
public void apply(JFreeChart chart) {
    ParamChecks.nullNotPermitted(chart, "chart");
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}
 
Example 11
Project: jfreechart   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 12
Project: jfreechart   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart ({@code null} not permitted).
 */
@Override
public void apply(JFreeChart chart) {
    Args.nullNotPermitted(chart, "chart");
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}
 
Example 13
Project: jfreechart   File: XYTitleAnnotationTest.java   View source code 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    TextTitle t = new TextTitle("Title");
    XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t);
    XYTitleAnnotation a2 = new XYTitleAnnotation(1.0, 2.0, t);
    assertTrue(a1.equals(a2));
    
    a1 = new XYTitleAnnotation(1.1, 2.0, t);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.0, t);
    assertTrue(a1.equals(a2));

    a1 = new XYTitleAnnotation(1.1, 2.2, t);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.2, t);
    assertTrue(a1.equals(a2));
    
    TextTitle t2 = new TextTitle("Title 2");
    a1 = new XYTitleAnnotation(1.1, 2.2, t2);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.2, t2);
    assertTrue(a1.equals(a2));
}
 
Example 14
Project: jasperreports   File: EyeCandySixtiesChartTheme.java   View source code 6 votes vote down vote up
@Override
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException
{
	super.configureChart(jfreeChart, jrPlot);

	TextTitle title = jfreeChart.getTitle();
	if (title != null)
	{
		RectangleInsets padding = title.getPadding();
		double bottomPadding = Math.max(padding.getBottom(), 15d);
		title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
	}

	GradientPaint gp = (GradientPaint)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BACKGROUND_PAINT);

	jfreeChart.setBackgroundPaint(new GradientPaint(0f, 0f, gp.getColor1(), 0f, getChart().getHeight() * 0.7f, gp.getColor2(), false));
}
 
Example 15
Project: jasperreports   File: SimpleChartTheme.java   View source code 6 votes vote down vote up
protected void setChartSubtitles(JFreeChart jfreeChart) throws JRException
{	
	TitleSettings subtitleSettings = getSubtitleSettings();
	
	Boolean subtitleVisibility = subtitleSettings.getShowTitle();

	if (subtitleVisibility == null || subtitleVisibility.booleanValue())
	{
		String subtitleText = evaluateTextExpression(getChart().getSubtitleExpression());
		if (subtitleText != null)
		{
			TextTitle subtitle = new TextTitle(subtitleText);
			Paint subtitleForecolor = getChart().getOwnSubtitleColor() != null  
				? getChart().getOwnSubtitleColor() 
				: subtitleSettings.getForegroundPaint() != null  
				? subtitleSettings.getForegroundPaint().getPaint()
				: getChart().getSubtitleColor();
			//Subtitle has not its own position set, and by default this will be set the same as title position
			RectangleEdge subtitleEdge = getEdge(subtitleSettings.getPositionValue(), jfreeChart.getTitle() == null ? null : jfreeChart.getTitle().getPosition());
			handleTitleSettings(subtitle, subtitleSettings, getChart().getSubtitleFont(), subtitleForecolor, subtitleEdge);

			jfreeChart.addSubtitle(subtitle);
		}
	}
}
 
Example 16
Project: aya-lang   File: XYTitleAnnotationTest.java   View source code 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    TextTitle t = new TextTitle("Title");
    XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t);
    XYTitleAnnotation a2 = new XYTitleAnnotation(1.0, 2.0, t);
    assertTrue(a1.equals(a2));
    
    a1 = new XYTitleAnnotation(1.1, 2.0, t);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.0, t);
    assertTrue(a1.equals(a2));

    a1 = new XYTitleAnnotation(1.1, 2.2, t);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.2, t);
    assertTrue(a1.equals(a2));
    
    TextTitle t2 = new TextTitle("Title 2");
    a1 = new XYTitleAnnotation(1.1, 2.2, t2);
    assertFalse(a1.equals(a2));
    a2 = new XYTitleAnnotation(1.1, 2.2, t2);
    assertTrue(a1.equals(a2));
}
 
Example 17
Project: aya-lang   File: BarChartFXDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 18
Project: aya-lang   File: BarChartDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 19
Project: aya-lang   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> 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);
}
 
Example 20
Project: aya-lang   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart (<code>null</code> not permitted).
 */
@Override
public void apply(JFreeChart chart) {
    ParamChecks.nullNotPermitted(chart, "chart");
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}
 
Example 21
Project: rapidminer-studio   File: JFreeChartPlotEngine.java   View source code 6 votes vote down vote up
private void setChartTitle() {
	JFreeChart chart = getCurrentChart();
	if (chart != null) {
		String text = plotInstance.getCurrentPlotConfigurationClone().getTitleText();
		if (text == null) {
			chart.setTitle(text);
			return;
		}

		Font font = plotInstance.getCurrentPlotConfigurationClone().getTitleFont();
		if (font == null) {
			font = FontTools.getFont(Font.DIALOG, Font.PLAIN, 10);
		}

		TextTitle textTitle = new TextTitle(text, font);
		textTitle.setPaint(plotInstance.getCurrentPlotConfigurationClone().getTitleColor());

		chart.setTitle(textTitle);

	}

}
 
Example 22
Project: bamboobsc   File: CommonPieChartAction.java   View source code 6 votes vote down vote up
private void fillChart(String title, List<String> names, 
		List<String> colors, List<Float> values) throws Exception {
	DefaultPieDataset data=new DefaultPieDataset();
	for (int ix=0; ix<names.size(); ix++) {
		data.setValue( names.get(ix), values.get(ix) );
	}
       this.chart=ChartFactory.createPieChart3D(
       		title, 
       		data, 
       		true,
       		true, 
       		false);
       LegendTitle legend=this.chart.getLegend();
       legend.setItemFont(new Font("", Font.TRUETYPE_FONT, 9) );
       PiePlot plot=(PiePlot)this.chart.getPlot();
       plot.setCircular(true);
       plot.setBackgroundAlpha(0.9f);       
       plot.setForegroundAlpha(0.5f);
       plot.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
       this.setPlotColor( plot, names, colors );
       this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9) ) ); 		
}
 
Example 23
Project: bamboobsc   File: CommonBarChartAction.java   View source code 6 votes vote down vote up
private void fillChart(String title, String categoryLabel, String valueLabel, 
		List<String> names, List<Float> values, List<String> colors, boolean horizontal) throws Exception {
	DefaultCategoryDataset data=new DefaultCategoryDataset();
	for (int ix=0; ix<names.size(); ix++) {			
		data.addValue(values.get(ix), "", names.get(ix));			
	}		
       this.chart=ChartFactory.createBarChart3D(
       		title, // title
       		categoryLabel,
       		valueLabel, 
       		data, 
       		( horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL ),
       		false,
       		false, 
       		false);		
       CategoryPlot plot=(CategoryPlot)this.chart.getPlot();
       CategoryAxis categoryAxis=plot.getDomainAxis();   
       categoryAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
       categoryAxis.setTickLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
       NumberAxis numberAxis=(NumberAxis)plot.getRangeAxis();
       numberAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
       this.setPlotColor(plot, names, colors);
       this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9) ) );		
}
 
Example 24
Project: opmap   File: Plotter.java   View source code 6 votes vote down vote up
public static JFreeChart createLine(final String title, final String subtitle, final String xAxis, final String yAxis, final XYDataset dataset) {
	JFreeChart plot = ChartFactory.createXYLineChart(
            (title != null)?title:"",
            xAxis,
            yAxis,
            dataset,
            PlotOrientation.VERTICAL,
            true,
            false,
            false
        ); 
	
	if (subtitle != null) {
		plot.addSubtitle(new TextTitle(subtitle, FONT_NL));
		//plot.addSubtitle(0, new TextTitle(subtitle, FONT_NL));
	}
		
	applyTheme(plot);
	
	return plot;
}
 
Example 25
Project: HTML5_WebSite   File: SpiderWebChartDemo1.java   View source code 6 votes vote down vote up
/**
   * Creates a sample chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      // get a reference to the plot for further customisation...
      SOCRSpiderWebPlot plot = new SOCRSpiderWebPlot(dataset);
      JFreeChart chart = new JFreeChart(
          chartTitle, TextTitle.DEFAULT_FONT, plot, false
      );

LegendTitle legend = new LegendTitle(plot);
      legend.setPosition(RectangleEdge.BOTTOM);

//renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
      chart.addSubtitle(legend);   

  	setCategorySummary(dataset);
  	if (legendPanelOn)
      	chart.removeLegend();
      return chart;
      
  }
 
Example 26
Project: HTML5_WebSite   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    setDataset(dataset);
    PiePlot piePlot = new PiePlot(null);
    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();
}
 
Example 27
Project: HTML5_WebSite   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart (<code>null</code> not permitted).
 */
public void apply(JFreeChart chart) {
    if (chart == null) {
        throw new IllegalArgumentException("Null 'chart' argument.");
    }
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}
 
Example 28
Project: populus   File: BarChartFXDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 29
Project: populus   File: BarChartDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 30
Project: populus   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> 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);
}
 
Example 31
Project: populus   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart (<code>null</code> not permitted).
 */
@Override
public void apply(JFreeChart chart) {
    ParamChecks.nullNotPermitted(chart, "chart");
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}
 
Example 32
Project: PI   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> 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);
}
 
Example 33
Project: PI   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart (<code>null</code> not permitted).
 */
public void apply(JFreeChart chart) {
    if (chart == null) {
        throw new IllegalArgumentException("Null 'chart' argument.");
    }
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}
 
Example 34
Project: nabs   File: Main.java   View source code 6 votes vote down vote up
private void setGenTitle(){
    StringBuilder builder = new StringBuilder();
    
    if(receptor != null) {
        // Obtains the receptor name
        builder.append("View From ");
        builder.append(receptor.toString());
        builder.append("\n");
    }

    // and the time the collection last started.
    builder.append("Since: ");
    builder.append(Util.getTimeStamp(lastReset, true, true));
    
    // set the title on the chart
    title = builder.toString();
    Font font = new Font("Verdana", Font.BOLD, 12);
    dataChart.setTitle(new TextTitle(title, font));
}
 
Example 35
Project: nabs   File: TitleTests.java   View source code 6 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    
    // use the TextTitle class because it is a concrete subclass
    Title t1 = new TextTitle();
    Title t2 = new TextTitle();
    assertEquals(t1, t2);
    
    t1.setPosition(RectangleEdge.LEFT);
    assertFalse(t1.equals(t2));
    t2.setPosition(RectangleEdge.LEFT);
    assertTrue(t1.equals(t2));
    
    t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));
    
    t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
    assertTrue(t1.equals(t2));
    
}
 
Example 36
Project: group-five   File: BarChartDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 37
Project: ECG-Viewer   File: BarChartFXDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 38
Project: ECG-Viewer   File: BarChartDemo1.java   View source code 6 votes vote down vote up
/**
 * Creates a sample chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
        "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
            + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}
 
Example 39
Project: ECG-Viewer   File: MultiplePiePlot.java   View source code 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> 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);
}
 
Example 40
Project: ECG-Viewer   File: StandardChartTheme.java   View source code 6 votes vote down vote up
/**
 * Applies this theme to the supplied chart.
 *
 * @param chart  the chart (<code>null</code> not permitted).
 */
@Override
public void apply(JFreeChart chart) {
    ParamChecks.nullNotPermitted(chart, "chart");
    TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(this.extraLargeFont);
        title.setPaint(this.titlePaint);
    }

    int subtitleCount = chart.getSubtitleCount();
    for (int i = 0; i < subtitleCount; i++) {
        applyToTitle(chart.getSubtitle(i));
    }

    chart.setBackgroundPaint(this.chartBackgroundPaint);

    // now process the plot if there is one
    Plot plot = chart.getPlot();
    if (plot != null) {
        applyToPlot(plot);
    }
}