Example usage for org.jfree.chart.title LegendTitle DEFAULT_ITEM_FONT

List of usage examples for org.jfree.chart.title LegendTitle DEFAULT_ITEM_FONT

Introduction

In this page you can find the example usage for org.jfree.chart.title LegendTitle DEFAULT_ITEM_FONT.

Prototype

Font DEFAULT_ITEM_FONT

To view the source code for org.jfree.chart.title LegendTitle DEFAULT_ITEM_FONT.

Click Source Link

Document

The default item font.

Usage

From source file:com.xpn.xwiki.plugin.charts.params.DefaultChartParams2.java

protected DefaultChartParams2() throws ParamException {
    set(SERIES, "columns");

    set(HEIGHT, new Integer(600));
    set(WIDTH, new Integer(500));
    set(LINK_ATTRIBUTES, new HashMap());
    set(IMAGE_ATTRIBUTES, new HashMap());

    set(RENDERER, (Class) null); // default renderer is chart type dependent
    set(RENDERER_COLOR, AbstractRenderer.DEFAULT_PAINT);
    set(RENDERER_STROKE, AbstractRenderer.DEFAULT_STROKE);
    set(RENDERER_SHAPE, AbstractRenderer.DEFAULT_SHAPE);
    set(RENDERER_FILL_COLOR, Color.white);
    set(RENDERER_OUTLINE_COLOR, AbstractRenderer.DEFAULT_OUTLINE_PAINT);
    set(RENDERER_OUTLINE_STROKE, AbstractRenderer.DEFAULT_OUTLINE_STROKE);
    set(RENDERER_ITEM_LABEL_VISIBLE, Boolean.FALSE);
    set(RENDERER_ITEM_LABEL_COLOR, AbstractRenderer.DEFAULT_VALUE_LABEL_PAINT);
    set(RENDERER_ITEM_LABEL_FONT, AbstractRenderer.DEFAULT_VALUE_LABEL_FONT);
    set(RENDERER_SERIES_VISIBLE, Boolean.TRUE);
    set(RENDERER_SERIES_VISIBLE_IN_LEGEND, Boolean.TRUE);

    set(BORDER_VISIBLE, Boolean.FALSE);
    set(BORDER_COLOR, Color.black);
    set(BORDER_STROKE, new BasicStroke(1.0f));

    setTitle(TITLE_PREFIX);//  w ww.  j a v  a2s .c  om
    set(TITLE_PREFIX + TITLE_FONT_SUFFIX, JFreeChart.DEFAULT_TITLE_FONT);
    setTitle(SUBTITLE_PREFIX);

    set(ANTI_ALIAS, Boolean.TRUE);
    set(BACKGROUND_COLOR, JFreeChart.DEFAULT_BACKGROUND_PAINT);

    set(PLOT_BACKGROUND_COLOR, Plot.DEFAULT_BACKGROUND_PAINT);
    set(PLOT_BACKGROUND_ALPHA, new Float(Plot.DEFAULT_BACKGROUND_ALPHA));
    set(PLOT_FOREGROUND_ALPHA, new Float(Plot.DEFAULT_FOREGROUND_ALPHA));
    set(PLOT_INSERTS, Plot.DEFAULT_INSETS);
    set(PLOT_OUTLINE_COLOR, Plot.DEFAULT_OUTLINE_PAINT);
    set(PLOT_OUTLINE_STROKE, Plot.DEFAULT_OUTLINE_STROKE);

    set(XYPLOT_ORIENTATION, PlotOrientation.VERTICAL);
    set(XYPLOT_QUADRANT_ORIGIN, new Point2D.Double(0.0, 0.0));
    List colors = new LinkedList();
    colors.add(null);
    colors.add(null);
    colors.add(null);
    colors.add(null);
    set(XYPLOT_QUADRANT_COLORS, colors);

    set(LEGEND_BACKGROUND_COLOR, (Color) null);
    set(LEGEND_ITEM_FONT, LegendTitle.DEFAULT_ITEM_FONT);
    set(LEGEND_ITEM_LABEL_PADDING, new RectangleInsets(2.0, 2.0, 2.0, 2.0));
    set(LEGEND_ITEM_GRAPHIC_ANCHOR, RectangleAnchor.CENTER);
    set(LEGEND_ITEM_GRAPHIC_EDGE, RectangleEdge.LEFT);
    set(LEGEND_ITEM_GRAPHIC_LOCATION, RectangleAnchor.CENTER);
    set(LEGEND_ITEM_GRAPHIC_PADDING, new RectangleInsets(2.0, 2.0, 2.0, 2.0));

    setAxis(AXIS_DOMAIN_PREFIX);
    setAxis(AXIS_RANGE_PREFIX);

    set(TIME_PERIOD_CLASS, Day.class);
    set(DATE_FORMAT, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"));
}

From source file:net.sf.jsfcomp.chartcreator.utils.ChartUtils.java

public static JFreeChart createChartWithType(ChartData chartData) {
    JFreeChart chart = null;//  w  ww  .j a  va 2  s  . co m
    Object datasource = chartData.getDatasource();
    if (datasource instanceof PieDataset) {
        chart = createChartWithPieDataSet(chartData);
    } else if (datasource instanceof CategoryDataset) {
        chart = createChartWithCategoryDataSet(chartData);
    } else if (datasource instanceof XYDataset) {
        chart = createChartWithXYDataSet(chartData);
    } else {
        throw new RuntimeException("Unsupported chart type");
    }

    if (chartData.getLegendFontSize() > 0)
        chart.getLegend().setItemFont(LegendTitle.DEFAULT_ITEM_FONT.deriveFont(chartData.getLegendFontSize()));

    if (!chartData.isLegendBorder())
        chart.getLegend().setBorder(0, 0, 0, 0);

    return chart;
}

From source file:org.ash.history.TopActivityPreview.java

/**
 * Add legend to chart panel.//from  ww  w.  j  av  a  2  s .c o  m
 * 
 * @param fontSize
 */
public void addLegend(int fontSize) {

    LegendTitle legend = new LegendTitle(chart.getPlot());

    BlockContainer wrapper = new BlockContainer(new BorderArrangement());
    wrapper.setFrame(new BlockBorder(1.0, 1.0, 1.0, 1.0));

    BlockContainer itemss = legend.getItemContainer();
    itemss.setPadding(2, 10, 5, 2);
    wrapper.add(itemss);
    legend.setWrapper(wrapper);

    legend.setItemFont(new Font(LegendTitle.DEFAULT_ITEM_FONT.getFontName(),
            LegendTitle.DEFAULT_ITEM_FONT.getStyle(), fontSize));

    legend.setPosition(RectangleEdge.RIGHT);
    legend.setHorizontalAlignment(HorizontalAlignment.LEFT);

    chart.addSubtitle(legend);

}

From source file:org.ash.history.detail.StackedChartDetail.java

/**
 * Creates the chart.//from  www  . j  a  v  a  2s . c o m
 * 
 * @return the jfreechart
 */
private JFreeChart createChart() {

    xAxis = new DateAxis("time");
    xAxis.setLabel(null);

    chart = ChartFactory.createStackedXYAreaChart("", // chart title
            "X Value", // domain axis label
            "Active Sessions", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            xAxis, // xAxis
            false, // legend
            true, // tooltips
            false // urls
    );

    chart.getTitle()
            .setFont(new Font(TextTitle.DEFAULT_FONT.getFontName(), TextTitle.DEFAULT_FONT.getStyle(), 14));

    plot = (XYPlot) chart.getPlot();
    renderer = new StackedXYAreaRenderer3();
    renderer.setRoundXCoordinates(true);
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} ({1}, {2})",
            new SimpleDateFormat("HH:mm"), new DecimalFormat("0.0")));
    plot.setRenderer(0, renderer);
    plot.getRangeAxis().setLowerBound(0.0);
    plot.getRangeAxis().setAutoRange(true);

    // Set format for x axis
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));

    // Add legend to right
    LegendTitle legend = new LegendTitle(chart.getPlot());

    BlockContainer wrapper = new BlockContainer(new BorderArrangement());
    wrapper.setFrame(new BlockBorder(1.0, 1.0, 1.0, 1.0));

    BlockContainer itemss = legend.getItemContainer();
    itemss.setPadding(2, 10, 5, 2);
    wrapper.add(itemss);
    legend.setWrapper(wrapper);

    legend.setPosition(RectangleEdge.RIGHT);
    legend.setHorizontalAlignment(HorizontalAlignment.LEFT);

    legend.setItemFont(new Font(LegendTitle.DEFAULT_ITEM_FONT.getFontName(),
            LegendTitle.DEFAULT_ITEM_FONT.getStyle(), 10));

    chart.addSubtitle(legend);

    return chart;
}