Example usage for org.jfree.chart.title TextTitle setText

List of usage examples for org.jfree.chart.title TextTitle setText

Introduction

In this page you can find the example usage for org.jfree.chart.title TextTitle setText.

Prototype

public void setText(String text) 

Source Link

Document

Sets the title to the specified text and sends a TitleChangeEvent to all registered listeners.

Usage

From source file:net.sf.jasperreports.components.spiderchart.SpiderChartDesignEvaluator.java

/**
 * /* w ww  .  j  a  va 2s  . co  m*/
 */
public static JRRenderable evaluateRenderer(ReportConverter reportConverter, JRComponentElement element) {
    SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent();
    ChartSettings chartSettings = chartComponent.getChartSettings();
    SpiderPlot plot = chartComponent.getPlot();

    SpiderWebPlot spiderWebPlot = new SpiderWebPlot(getSampleDataset());

    if (plot.getAxisLineColor() != null) {
        spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor());
    }
    if (plot.getAxisLineWidth() != null) {
        spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth()));
    }
    if (plot.getBackcolor() != null) {
        spiderWebPlot.setBackgroundPaint(plot.getBackcolor());
    }
    if (plot.getBackgroundAlpha() != null) {
        spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha());
    }
    if (plot.getForegroundAlpha() != null) {
        spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha());
    }
    if (plot.getHeadPercent() != null) {
        spiderWebPlot.setHeadPercent(plot.getHeadPercent());
    }
    if (plot.getInteriorGap() != null) {
        spiderWebPlot.setInteriorGap(plot.getInteriorGap());
    }
    if (plot.getLabelColor() != null) {
        spiderWebPlot.setLabelPaint(plot.getLabelColor());
    }
    if (plot.getLabelFont() != null) {
        spiderWebPlot.setLabelFont(JRFontUtil.getAwtFont(plot.getLabelFont(), Locale.getDefault()));
    }
    if (plot.getLabelGap() != null) {
        spiderWebPlot.setAxisLabelGap(plot.getLabelGap());
    }

    spiderWebPlot.setMaxValue(MAX_VALUE);

    if (plot.getRotation() != null) {
        spiderWebPlot.setDirection(plot.getRotation().getRotation());
    }
    if (plot.getStartAngle() != null) {
        spiderWebPlot.setStartAngle(plot.getStartAngle());
    }
    if (plot.getTableOrder() != null) {
        spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder());
    }
    if (plot.getWebFilled() != null) {
        spiderWebPlot.setWebFilled(plot.getWebFilled());
    }

    spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    spiderWebPlot.setLabelGenerator(new StandardCategoryItemLabelGenerator());

    String titleText = JRExpressionUtil.getExpressionText(chartSettings.getTitleExpression());

    Font titleFont = chartSettings.getTitleFont() != null
            ? JRFontUtil.getAwtFont(chartSettings.getTitleFont(), Locale.getDefault())
            : TextTitle.DEFAULT_FONT;

    JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true);

    if (chartSettings.getBackcolor() != null) {
        jfreechart.setBackgroundPaint(chartSettings.getBackcolor());
    }

    RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP);

    if (titleText != null) {
        TextTitle title = jfreechart.getTitle();
        title.setText(titleText);
        if (chartSettings.getTitleColor() != null) {
            title.setPaint(chartSettings.getTitleColor());
        }

        title.setFont(titleFont);
        title.setPosition(titleEdge);
        jfreechart.setTitle(title);
    }

    String subtitleText = JRExpressionUtil.getExpressionText(chartSettings.getSubtitleExpression());
    if (subtitleText != null) {
        TextTitle subtitle = new TextTitle(subtitleText);
        subtitle.setText(subtitleText);
        if (chartSettings.getSubtitleColor() != null) {
            subtitle.setPaint(chartSettings.getSubtitleColor());
        }

        if (chartSettings.getSubtitleColor() != null) {
            Font subtitleFont = chartSettings.getSubtitleFont() != null
                    ? JRFontUtil.getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault())
                    : TextTitle.DEFAULT_FONT;
            subtitle.setFont(subtitleFont);
        }

        subtitle.setPosition(titleEdge);

        jfreechart.addSubtitle(subtitle);
    }

    // Apply all of the legend formatting options
    LegendTitle legend = jfreechart.getLegend();
    if (legend != null) {
        legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend()));
        if (legend.isVisible()) {
            if (chartSettings.getLegendColor() != null) {
                legend.setItemPaint(chartSettings.getLegendColor());
            }
            if (chartSettings.getLegendBackgroundColor() != null) {
                legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor());
            }

            if (chartSettings.getLegendFont() != null) {
                legend.setItemFont(JRFontUtil.getAwtFont(chartSettings.getLegendFont(), Locale.getDefault()));
            }
            legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM));
        }
    }

    Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight());

    String renderType = chartSettings.getRenderType();
    if (renderType == null) {
        renderType = JRProperties.getProperty(reportConverter.getReport(), JRChart.PROPERTY_CHART_RENDER_TYPE);
    }

    return ChartUtil.getChartRendererFactory(renderType).getRenderer(jfreechart, null, rectangle);
}

From source file:net.sf.jasperreports.components.spiderchart.SpiderChartRendererEvaluator.java

/**
 * /*from   www.ja va  2 s.  co m*/
 */
public static Renderable evaluateRenderable(JasperReportsContext jasperReportsContext,
        JRComponentElement element, SpiderChartSharedBean spiderchartBean, ChartCustomizer chartCustomizer,
        String defaultRenderType, String datasetType) {
    SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent();
    ChartSettings chartSettings = chartComponent.getChartSettings();
    SpiderPlot plot = (SpiderPlot) chartComponent.getPlot();

    DefaultCategoryDataset dataset = null;
    StandardCategoryItemLabelGenerator labelGenerator = null;

    if (FILL_DATASET.equals(datasetType)) {
        dataset = ((FillSpiderDataset) spiderchartBean.getDataset()).getCustomDataset();
        labelGenerator = ((FillSpiderDataset) spiderchartBean.getDataset()).getLabelGenerator();
    } else {
        dataset = getSampleDataset();
        labelGenerator = new StandardCategoryItemLabelGenerator();
    }

    SpiderWebPlot spiderWebPlot = new SpiderWebPlot(dataset);

    if (plot.getAxisLineColor() != null) {
        spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor());
    }
    if (plot.getAxisLineWidth() != null) {
        spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth()));
    }
    if (plot.getBackcolor() != null) {
        spiderWebPlot.setBackgroundPaint(plot.getBackcolor());
    }
    if (plot.getBackgroundAlpha() != null) {
        spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha());
    }
    if (plot.getForegroundAlpha() != null) {
        spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha());
    }
    if (plot.getHeadPercent() != null) {
        spiderWebPlot.setHeadPercent(plot.getHeadPercent());
    }
    if (plot.getInteriorGap() != null) {
        spiderWebPlot.setInteriorGap(plot.getInteriorGap());
    }
    if (plot.getLabelColor() != null) {
        spiderWebPlot.setLabelPaint(plot.getLabelColor());
    }
    if (plot.getLabelFont() != null) {
        spiderWebPlot.setLabelFont(FontUtil.getInstance(jasperReportsContext).getAwtFont(plot.getLabelFont(),
                Locale.getDefault()));
    }
    if (plot.getLabelGap() != null) {
        spiderWebPlot.setAxisLabelGap(plot.getLabelGap());
    }
    if (spiderchartBean.getMaxValue() != null) {
        spiderWebPlot.setMaxValue(spiderchartBean.getMaxValue());
    }
    if (plot.getRotation() != null) {
        spiderWebPlot.setDirection(plot.getRotation().getRotation());
    }
    if (plot.getStartAngle() != null) {
        spiderWebPlot.setStartAngle(plot.getStartAngle());
    }
    if (plot.getTableOrder() != null) {
        spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder());
    }
    if (plot.getWebFilled() != null) {
        spiderWebPlot.setWebFilled(plot.getWebFilled());
    }

    spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    spiderWebPlot.setLabelGenerator(labelGenerator);

    Font titleFont = chartSettings.getTitleFont() != null ? FontUtil.getInstance(jasperReportsContext)
            .getAwtFont(chartSettings.getTitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT;

    String titleText = spiderchartBean.getTitleText();

    JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true);

    Color backcolor = chartSettings.getBackcolor() != null ? chartSettings.getBackcolor()
            : element.getBackcolor();
    if (backcolor != null) {
        jfreechart.setBackgroundPaint(backcolor);
    }

    RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP);

    if (titleText != null) {
        TextTitle title = jfreechart.getTitle();
        title.setText(titleText);
        if (chartSettings.getTitleColor() != null) {
            title.setPaint(chartSettings.getTitleColor());
        }

        title.setFont(titleFont);
        title.setPosition(titleEdge);
        jfreechart.setTitle(title);
    }

    String subtitleText = spiderchartBean.getSubtitleText();
    if (subtitleText != null) {
        TextTitle subtitle = new TextTitle(subtitleText);
        subtitle.setText(subtitleText);
        if (chartSettings.getSubtitleColor() != null) {
            subtitle.setPaint(chartSettings.getSubtitleColor());
        }

        if (chartSettings.getSubtitleColor() != null) {
            Font subtitleFont = chartSettings.getSubtitleFont() != null
                    ? FontUtil.getInstance(jasperReportsContext).getAwtFont(chartSettings.getSubtitleFont(),
                            Locale.getDefault())
                    : TextTitle.DEFAULT_FONT;
            subtitle.setFont(subtitleFont);
        }

        subtitle.setPosition(titleEdge);

        jfreechart.addSubtitle(subtitle);
    }

    // Apply all of the legend formatting options
    LegendTitle legend = jfreechart.getLegend();

    if (legend != null) {
        legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend()));
        if (legend.isVisible()) {
            if (chartSettings.getLegendColor() != null) {
                legend.setItemPaint(chartSettings.getLegendColor());
            }
            if (chartSettings.getLegendBackgroundColor() != null) {
                legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor());
            }

            if (chartSettings.getLegendFont() != null) {
                legend.setItemFont(FontUtil.getInstance(jasperReportsContext)
                        .getAwtFont(chartSettings.getLegendFont(), Locale.getDefault()));
            }
            legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM));
        }
    }

    String renderType = chartSettings.getRenderType() == null ? defaultRenderType
            : chartSettings.getRenderType();
    Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight());

    if (chartCustomizer != null) {
        chartCustomizer.customize(jfreechart, chartComponent);
    }

    return ChartUtil.getInstance(jasperReportsContext).getChartRenderableFactory(renderType)
            .getRenderable(jasperReportsContext, jfreechart, spiderchartBean.getHyperlinkProvider(), rectangle);
}

From source file:daylightchart.options.chart.TitleOptions.java

/**
 * {@inheritDoc}/*w w  w. j  av  a  2s  . c  o  m*/
 *
 * @see BaseChartOptions#updateChart(org.jfree.chart.JFreeChart)
 */
@Override
public void updateChart(final JFreeChart chart) {
    if (hideTitle) {
        final TextTitle title = chart.getTitle();
        if (title != null) {
            title.setFont(titleFont);
            title.setPaint(titlePaint);
            title.setText(titleText);
        }
    } else {
        chart.setTitle((TextTitle) null);
    }
}

From source file:edu.jhuapl.graphs.jfreechart.JFreeChartPieGraphSource.java

@SuppressWarnings("unchecked")
@Override/* w  w w .ja  v a  2s .  c o m*/
public void initialize() throws GraphException {
    String title = getParam(GraphSource.GRAPH_TITLE, String.class, DEFAULT_TITLE);
    boolean legend = getParam(GraphSource.GRAPH_LEGEND, Boolean.class, DEFAULT_GRAPH_LEGEND);
    boolean graphToolTip = getParam(GraphSource.GRAPH_TOOL_TIP, Boolean.class, DEFAULT_GRAPH_TOOL_TIP);
    boolean graphDisplayLabel = getParam(GraphSource.GRAPH_DISPLAY_LABEL, Boolean.class, false);
    boolean legendBorder = getParam(GraphSource.LEGEND_BORDER, Boolean.class, DEFAULT_LEGEND_BORDER);
    boolean graphBorder = getParam(GraphSource.GRAPH_BORDER, Boolean.class, DEFAULT_GRAPH_BORDER);
    Font titleFont = getParam(GraphSource.GRAPH_FONT, Font.class, DEFAULT_GRAPH_TITLE_FONT);
    String noDataMessage = getParam(GraphSource.GRAPH_NO_DATA_MESSAGE, String.class,
            DEFAULT_GRAPH_NO_DATA_MESSAGE);
    PieGraphData pieGraphData = makeDataSet();
    Map<Comparable, Paint> colors = pieGraphData.colors;

    this.chart = ChartFactory.createPieChart(title, pieGraphData.data, false, graphToolTip, false);

    Paint backgroundColor = getParam(GraphSource.BACKGROUND_COLOR, Paint.class, DEFAULT_BACKGROUND_COLOR);
    Paint plotColor = getParam(JFreeChartTimeSeriesGraphSource.PLOT_COLOR, Paint.class, backgroundColor);
    Paint labelColor = getParam(JFreeChartTimeSeriesGraphSource.GRAPH_LABEL_BACKGROUND_COLOR, Paint.class,
            DEFAULT_BACKGROUND_COLOR);

    this.chart.setBackgroundPaint(backgroundColor);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(plotColor);
    plot.setNoDataMessage(noDataMessage);

    if (!graphDisplayLabel) {
        plot.setLabelGenerator(null);
    } else {
        plot.setInteriorGap(0.001);
        plot.setMaximumLabelWidth(.3);
        //           plot.setIgnoreNullValues(true);
        plot.setIgnoreZeroValues(true);
        plot.setShadowPaint(null);
        //           plot.setOutlineVisible(false);
        //TODO use title font?
        Font font = plot.getLabelFont();
        plot.setLabelLinkStyle(PieLabelLinkStyle.CUBIC_CURVE);
        plot.setLabelFont(font.deriveFont(font.getSize2D() * .75f));
        plot.setLabelBackgroundPaint(labelColor);
        plot.setLabelShadowPaint(null);
        plot.setLabelOutlinePaint(null);
        plot.setLabelGap(0.001);
        plot.setLabelLinkMargin(0.0);
        plot.setLabelLinksVisible(true);
        //           plot.setSimpleLabels(true);
        //           plot.setCircular(true);
    }

    if (!graphBorder) {
        plot.setOutlineVisible(false);
    }

    if (title != null && !"".equals(title)) {
        TextTitle title1 = new TextTitle();
        title1.setText(title);
        title1.setFont(titleFont);
        title1.setPadding(3, 2, 5, 2);
        chart.setTitle(title1);
    } else {
        chart.setTitle((TextTitle) null);
    }
    plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1));
    //Makes a wrapper for the legend to remove the border around it
    if (legend) {
        LegendTitle legend1 = new LegendTitle(chart.getPlot());
        BlockContainer wrapper = new BlockContainer(new BorderArrangement());

        if (legendBorder) {
            wrapper.setFrame(new BlockBorder(1, 1, 1, 1));
        } else {
            wrapper.setFrame(new BlockBorder(0, 0, 0, 0));
        }

        BlockContainer items = legend1.getItemContainer();
        items.setPadding(2, 10, 5, 2);
        wrapper.add(items);
        legend1.setWrapper(wrapper);
        legend1.setPosition(RectangleEdge.BOTTOM);
        legend1.setHorizontalAlignment(HorizontalAlignment.CENTER);

        if (params.get(GraphSource.LEGEND_FONT) instanceof Font) {
            legend1.setItemFont(((Font) params.get(GraphSource.LEGEND_FONT)));
        }

        chart.addSubtitle(legend1);
        plot.setLegendLabelGenerator(new PieGraphLabelGenerator());
    }

    for (Comparable category : colors.keySet()) {
        plot.setSectionPaint(category, colors.get(category));
    }

    plot.setToolTipGenerator(new PieGraphToolTipGenerator(pieGraphData));
    plot.setURLGenerator(new PieGraphURLGenerator(pieGraphData));

    initialized = true;
}

From source file:edu.jhuapl.graphs.jfreechart.JFreeChartCategoryGraphSource.java

@Override
public void initialize() throws GraphException {
    String title = getParam(GraphSource.GRAPH_TITLE, String.class, DEFAULT_TITLE);
    String xLabel = getParam(GraphSource.GRAPH_X_LABEL, String.class, DEFAULT_DOMAIN_LABEL);
    String yLabel = getParam(GraphSource.GRAPH_Y_LABEL, String.class, DEFAULT_RANGE_LABEL);
    CategoryDataset dataset = makeDataSet();

    chart = createChart(title, xLabel, yLabel, dataset, false, false);

    // start customizing the graph
    Paint backgroundColor = getParam(GraphSource.BACKGROUND_COLOR, Paint.class, DEFAULT_BACKGROUND_COLOR);
    Paint plotColor = getParam(JFreeChartTimeSeriesGraphSource.PLOT_COLOR, Paint.class, backgroundColor);
    Double offset = getParam(GraphSource.AXIS_OFFSET, Double.class, DEFAULT_AXIS_OFFSET);
    Paint graphDomainGridlinePaint = getParam(GraphSource.GRAPH_DOMAIN_GRIDLINE_PAINT, Paint.class,
            backgroundColor);//from   www.  j  av  a 2 s . com
    Paint graphRangeGridlinePaint = getParam(GraphSource.GRAPH_RANGE_GRIDLINE_PAINT, Paint.class,
            backgroundColor);
    boolean graphBorder = getParam(GraphSource.GRAPH_BORDER, Boolean.class, DEFAULT_GRAPH_BORDER);

    chart.setBackgroundPaint(backgroundColor);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(plotColor);
    plot.setAxisOffset(new RectangleInsets(offset, offset, offset, offset));
    plot.setDomainGridlinePaint(graphDomainGridlinePaint);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(graphRangeGridlinePaint);
    plot.setOutlineVisible(graphBorder);

    // set the axis location
    AxisLocation axisLocation = getParam(GraphSource.GRAPH_RANGE_AXIS_LOCATION, AxisLocation.class,
            AxisLocation.TOP_OR_LEFT);
    plot.setRangeAxisLocation(axisLocation);

    // customize the y-axis
    if (params.get(RANGE_AXIS) instanceof ValueAxis) {
        ValueAxis valueAxis = (ValueAxis) params.get(RANGE_AXIS);
        plot.setRangeAxis(valueAxis);
    }

    ValueAxis valueAxis = plot.getRangeAxis();
    Object yAxisFont = params.get(GraphSource.GRAPH_Y_AXIS_FONT);
    Object yAxisLabelFont = params.get(GraphSource.GRAPH_Y_AXIS_LABEL_FONT);
    Double rangeLowerBound = getParam(GraphSource.GRAPH_RANGE_LOWER_BOUND, Double.class, null);
    Double rangeUpperBound = getParam(GraphSource.GRAPH_RANGE_UPPER_BOUND, Double.class, null);
    boolean graphRangeIntegerTick = getParam(GraphSource.GRAPH_RANGE_INTEGER_TICK, Boolean.class, false);
    boolean graphRangeMinorTickVisible = getParam(GraphSource.GRAPH_RANGE_MINOR_TICK_VISIBLE, Boolean.class,
            true);

    if (yAxisFont instanceof Font) {
        valueAxis.setTickLabelFont((Font) yAxisFont);
    }

    if (yAxisLabelFont instanceof Font) {
        valueAxis.setLabelFont((Font) yAxisLabelFont);
    }

    if (rangeLowerBound != null) {
        valueAxis.setLowerBound(rangeLowerBound);
    }

    if (rangeUpperBound != null) {
        valueAxis.setUpperBound(rangeUpperBound);
    }

    if (graphRangeIntegerTick) {
        valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    }

    valueAxis.setMinorTickMarksVisible(graphRangeMinorTickVisible);

    // customize the x-axis
    if (params.get(DOMAIN_AXIS) instanceof CategoryAxis) {
        CategoryAxis domainAxis = (CategoryAxis) params.get(DOMAIN_AXIS);
        plot.setDomainAxis(domainAxis);
    }

    CategoryAxis domainAxis = plot.getDomainAxis();
    Object xAxisFont = params.get(GraphSource.GRAPH_X_AXIS_FONT);
    Object xAxisLabelFont = params.get(GraphSource.GRAPH_X_AXIS_LABEL_FONT);

    if (xAxisFont instanceof Font) {
        domainAxis.setTickLabelFont((Font) xAxisFont);
    }

    if (xAxisLabelFont instanceof Font) {
        domainAxis.setLabelFont((Font) xAxisLabelFont);
    }

    domainAxis.setLabel(xLabel);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    plot.setDomainAxis(domainAxis);

    // change the font of the graph title
    Font titleFont = getParam(GraphSource.GRAPH_FONT, Font.class, DEFAULT_GRAPH_TITLE_FONT);
    TextTitle textTitle = new TextTitle();
    textTitle.setText(title);
    textTitle.setFont(titleFont);
    chart.setTitle(textTitle);

    // makes a wrapper for the legend to remove the border around it
    boolean legend = getParam(GraphSource.GRAPH_LEGEND, Boolean.class, DEFAULT_GRAPH_LEGEND);
    boolean legendBorder = getParam(GraphSource.LEGEND_BORDER, Boolean.class, DEFAULT_LEGEND_BORDER);
    Object legendFont = params.get(GraphSource.LEGEND_FONT);

    if (legend) {
        LegendTitle legendTitle = new LegendTitle(chart.getPlot());
        BlockContainer wrapper = new BlockContainer(new BorderArrangement());

        if (legendBorder) {
            wrapper.setFrame(new BlockBorder(1, 1, 1, 1));
        } else {
            wrapper.setFrame(new BlockBorder(0, 0, 0, 0));
        }

        BlockContainer items = legendTitle.getItemContainer();
        items.setPadding(2, 10, 5, 2);
        wrapper.add(items);
        legendTitle.setWrapper(wrapper);
        legendTitle.setPosition(RectangleEdge.BOTTOM);
        legendTitle.setHorizontalAlignment(HorizontalAlignment.CENTER);

        if (legendFont instanceof Font) {
            legendTitle.setItemFont((Font) legendFont);
        }

        chart.addSubtitle(legendTitle);
    }

    this.initialized = true;
}

From source file:com.rcp.wbw.demo.editor.SWTTitleEditor.java

/**
 * Sets the properties of the specified title to match the properties
 * defined on this panel.//from w w w. j  a v a  2s . c  o  m
 * 
 * @param chart
 *            the chart whose title is to be modified.
 */
public void setTitleProperties(JFreeChart chart) {
    if (this.showTitle) {
        TextTitle title = chart.getTitle();
        if (title == null) {
            title = new TextTitle();
            chart.setTitle(title);
        }
        title.setText(getTitleText());
        title.setFont(SWTUtils.toAwtFont(getDisplay(), getTitleFont(), true));
        title.setPaint(SWTUtils.toAwtColor(getTitleColor()));
    } else {
        chart.setTitle((TextTitle) null);
    }
}

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultTitleEditor.java

/**
 * Sets the properties of the specified title to match the properties
 * defined on this panel./*w w  w  .j  av a 2 s.  co m*/
 * 
 * @param chart
 *            the chart whose title is to be modified.
 */
public void setTitleProperties(JFreeChart chart) {
    TextTitle title = chart.getTitle();
    if (title == null) {
        title = new TextTitle();
        chart.setTitle(title);
    }
    title.setText(getTitleText());
    title.setFont(getTitleFont());
    title.setPaint(getTitlePaint());
    title.setVisible(this.showTitle);
}

From source file:org.n52.io.measurement.img.ChartIoHandler.java

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(BLACK);/*from  www .ja v a 2s  . c  o m*/
        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);
    }
}

From source file:com.bdaum.zoom.report.internal.wizards.ReportComponent.java

private static void applyProperties(JFreeChart chart, Map<String, Object> properties) {
    if (properties != null) {
        String text = (String) properties.get(TITLE);
        if (text != null) {
            TextTitle title = chart.getTitle();
            if (title == null) {
                title = new TextTitle();
                chart.setTitle(title);//w  w w  .j  a  va  2 s. com
            }
            title.setText(text);
            Font titleFont = (Font) properties.get(TITLEFONT);
            if (titleFont != null)
                title.setFont(titleFont);
            Paint paint = (Paint) properties.get(TITLECOLOR);
            if (paint != null)
                title.setPaint(paint);
        } else
            chart.setTitle((TextTitle) null);
        Plot plot = chart.getPlot();
        Paint paint = (Paint) properties.get(BGCOLOR);
        if (paint != null)
            plot.setBackgroundPaint(paint);
        paint = (Color) properties.get(OUTLINEPAINT);
        if (paint != null)
            plot.setOutlinePaint(paint);
        Stroke stroke = (Stroke) properties.get(OUTLINESTROKE);
        if (stroke != null)
            plot.setOutlineStroke(stroke);
        PlotOrientation orientation = (PlotOrientation) properties.get(ORIENTATION);
        Axis domainAxis = null;
        Axis rangeAxis = null;
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            domainAxis = p.getDomainAxis();
            rangeAxis = p.getRangeAxis();
            if (orientation != null)
                p.setOrientation(orientation);
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            domainAxis = p.getDomainAxis();
            rangeAxis = p.getRangeAxis();
            if (orientation != null)
                p.setOrientation(orientation);
        }
        if (domainAxis != null)
            applyAxisProperties(domainAxis, "x", properties); //$NON-NLS-1$
        if (rangeAxis != null)
            applyAxisProperties(rangeAxis, "y", properties); //$NON-NLS-1$
        Boolean anti = (Boolean) properties.get(ANTIALIAS);
        if (anti != null)
            chart.setAntiAlias(anti);
        paint = (Paint) properties.get(CANVASPAINT);
        if (paint != null)
            chart.setBackgroundPaint(paint);
    }

}

From source file:org.n52.io.type.quantity.handler.img.ChartIoHandler.java

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);//from   w  w w.ja  va2 s  . co  m
    }
}