Example usage for org.jfree.chart.title Title DEFAULT_HORIZONTAL_ALIGNMENT

List of usage examples for org.jfree.chart.title Title DEFAULT_HORIZONTAL_ALIGNMENT

Introduction

In this page you can find the example usage for org.jfree.chart.title Title DEFAULT_HORIZONTAL_ALIGNMENT.

Prototype

HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT

To view the source code for org.jfree.chart.title Title DEFAULT_HORIZONTAL_ALIGNMENT.

Click Source Link

Document

The default horizontal alignment.

Usage

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

void setTitle(String prefix) throws ParamException {
    set(prefix + TITLE_SUFFIX, ""); // ?
    set(prefix + TITLE_BACKGROUND_COLOR_SUFFIX, (Color) null);
    set(prefix + TITLE_POSITION_SUFFIX, Title.DEFAULT_POSITION);
    set(prefix + TITLE_HORIZONTAL_ALIGNMENT_SUFFIX, Title.DEFAULT_HORIZONTAL_ALIGNMENT);
    set(prefix + TITLE_VERTICAL_ALIGNMENT_SUFFIX, Title.DEFAULT_VERTICAL_ALIGNMENT);
    set(prefix + TITLE_COLOR_SUFFIX, TextTitle.DEFAULT_TEXT_PAINT);
    set(prefix + TITLE_FONT_SUFFIX, TextTitle.DEFAULT_FONT);
    set(prefix + TITLE_PADDING_SUFFIX, Title.DEFAULT_PADDING);
}

From source file:piramide.interaction.reasoner.FuzzyReasonerWizardFacade.java

@Override
public void generateMembershipFunctionGraph(boolean isInput, boolean isDevices, String variableName,
        RegionDistributionInfo[] linguisticTerms, OutputStream destination, int width, int height,
        Geolocation geo, DecayFunctions decayFunction, Calendar when) {
    BufferedImage img;// w ww  . j a va  2 s.c o  m
    if (variableName == null) {
        img = createErrorMessagesImage("Error generating graph: variableName not provided");
    } else if (linguisticTerms == null) {
        img = createErrorMessagesImage("Error generating graph: linguisticTerms not provided");
    } else if (isInput && isDevices && !isValidDeviceVariableName(variableName)) {
        img = createErrorMessagesImage("Error generating graph: invalid device variable name: " + variableName);
    } else if (isInput && !isDevices && !isValidUserVariableName(variableName)) {
        img = createErrorMessagesImage("Error generating graph: invalid user variable name: " + variableName);
    } else {
        try {
            final WarningStore warningStore = new WarningStore();
            final net.sourceforge.jFuzzyLogic.rule.Variable variable = processVariable(isInput, isDevices,
                    variableName, linguisticTerms, geo, decayFunction, when, warningStore);

            final JFreeChart theChart = variable.chart(false);

            final String[] messages = warningStore.getMessages();
            if (messages.length > 0) {
                final Font font = TextTitle.DEFAULT_FONT;
                final Font bigBold = new Font(font.getName(), Font.BOLD, font.getSize() + 2);
                final Font bold = new Font(font.getName(), Font.BOLD, font.getSize());

                theChart.addSubtitle(new TextTitle("WARNINGS:", bigBold, Color.RED, Title.DEFAULT_POSITION,
                        Title.DEFAULT_HORIZONTAL_ALIGNMENT, Title.DEFAULT_VERTICAL_ALIGNMENT,
                        Title.DEFAULT_PADDING));
                for (String message : messages)
                    theChart.addSubtitle(new TextTitle(message, bold, Color.RED, Title.DEFAULT_POSITION,
                            Title.DEFAULT_HORIZONTAL_ALIGNMENT, Title.DEFAULT_VERTICAL_ALIGNMENT,
                            Title.DEFAULT_PADDING));
            }
            img = theChart.createBufferedImage(width, height);

        } catch (FuzzyReasonerException e) {
            e.printStackTrace();
            img = createErrorMessagesImage("Error generating graph: " + e.getMessage());
        }
    }

    try {
        final ImageEncoder myEncoder = ImageEncoderFactory.newInstance("png");
        myEncoder.encode(img, destination);
        destination.flush();
        destination.close();
    } catch (IOException e) {
        // Cry
        e.printStackTrace();
        return;
    }
}