Example usage for org.jfree.chart.axis CategoryAnchor END

List of usage examples for org.jfree.chart.axis CategoryAnchor END

Introduction

In this page you can find the example usage for org.jfree.chart.axis CategoryAnchor END.

Prototype

CategoryAnchor END

To view the source code for org.jfree.chart.axis CategoryAnchor END.

Click Source Link

Document

End of period.

Usage

From source file:org.jfree.chart.demo.SurveyResultsDemo1.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart(null, null, null, categorydataset,
            PlotOrientation.HORIZONTAL, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    TextTitle texttitle = new TextTitle(
            "Figure 7 | I. Resources - The site offers users relevant, informative and educational resources");
    texttitle.setHorizontalAlignment(HorizontalAlignment.LEFT);
    texttitle.setBackgroundPaint(Color.red);
    texttitle.setPaint(Color.white);
    jfreechart.setTitle(texttitle);//from   w w  w  . j  av  a 2s . c  o  m
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setOutlinePaint(null);
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryplot.setDomainGridlineStroke(new BasicStroke(0.5F));
    categoryplot.setDomainGridlinePaint(Color.black);
    categoryplot.setRangeGridlinesVisible(false);
    categoryplot.clearRangeMarkers();
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setVisible(false);
    categoryaxis.setCategoryMargin(0.5D);
    categoryplot.getRangeAxis().setVisible(false);
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setSeriesPaint(0, new Color(156, 164, 74));
    barrenderer.setDrawBarOutline(false);
    barrenderer.setBaseItemLabelsVisible(true);
    barrenderer.setBaseItemLabelFont(new Font("SansSerif", 1, 10));
    ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
            TextAnchor.CENTER_RIGHT);
    barrenderer.setBasePositiveItemLabelPosition(itemlabelposition);
    CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation("1. White papers are available.",
            "Category 1", 0.0D);
    categorytextannotation.setFont(new Font("SansSerif", 1, 12));
    categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation);
    CategoryTextAnnotation categorytextannotation1 = new CategoryTextAnnotation(
            "2. White papers enhance users understanding of the firm and its expertise.", "Category 2", 0.0D);
    categorytextannotation1.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation1.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation1.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation1);
    CategoryTextAnnotation categorytextannotation2 = new CategoryTextAnnotation(
            "3. White papers are relevant to the firm's prospects and clients.", "Category 3", 0.0D);
    categorytextannotation2.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation2.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation2.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation2);
    CategoryTextAnnotation categorytextannotation3 = new CategoryTextAnnotation(
            "4. White papers are relevant to the firm's positioning.", "Category 4", 0.0D);
    categorytextannotation3.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation3.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation3.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation3);
    CategoryTextAnnotation categorytextannotation4 = new CategoryTextAnnotation(
            "5. Case studies are available.", "Category 5", 0.0D);
    categorytextannotation4.setFont(new Font("SansSerif", 1, 12));
    categorytextannotation4.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation4.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation4);
    CategoryTextAnnotation categorytextannotation5 = new CategoryTextAnnotation(
            "6. Case studies enhance users understanding of the firm and its expertise.", "Category 6", 0.0D);
    categorytextannotation5.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation5.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation5.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation5);
    CategoryTextAnnotation categorytextannotation6 = new CategoryTextAnnotation(
            "7. Case studies are relevant to the firm's prospects and clients.", "Category 7", 0.0D);
    categorytextannotation6.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation6.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation6.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation6);
    CategoryTextAnnotation categorytextannotation7 = new CategoryTextAnnotation(
            "8. White papers are relevant to the firm's positioning.", "Category 8", 0.0D);
    categorytextannotation7.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation7.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation7.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation7);
    CategoryTextAnnotation categorytextannotation8 = new CategoryTextAnnotation(
            "9. Case studies are available.", "Category 9", 0.0D);
    categorytextannotation8.setFont(new Font("SansSerif", 1, 12));
    categorytextannotation8.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation8.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation8);
    CategoryTextAnnotation categorytextannotation9 = new CategoryTextAnnotation(
            "10. Case studies enhance users understanding of the firm and its expertise.", "Category 10", 0.0D);
    categorytextannotation9.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation9.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation9.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation9);
    CategoryTextAnnotation categorytextannotation10 = new CategoryTextAnnotation(
            "11. Case studies are relevant to the firm's prospects and clients.", "Category 11", 0.0D);
    categorytextannotation10.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation10.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation10.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation10);
    CategoryTextAnnotation categorytextannotation11 = new CategoryTextAnnotation(
            "12. White papers are relevant to the firm's positioning.", "Category 12", 0.0D);
    categorytextannotation11.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation11.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation11.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation11);
    CategoryTextAnnotation categorytextannotation12 = new CategoryTextAnnotation(
            "13. Users can easily access resources based on viewer interest.", "Category 13", 0.0D);
    categorytextannotation12.setFont(new Font("SansSerif", 1, 12));
    categorytextannotation12.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation12.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation12);
    CategoryTextAnnotation categorytextannotation13 = new CategoryTextAnnotation(
            "14. Access to additional hyperlinks enhances users's ability to find relevant information.",
            "Category 14", 0.0D);
    categorytextannotation13.setFont(new Font("SansSerif", 1, 12));
    categorytextannotation13.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation13.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation13);
    CategoryTextAnnotation categorytextannotation14 = new CategoryTextAnnotation("15. OVERALL EFFECTIVENESS.",
            "Overall", 0.0D);
    categorytextannotation14.setFont(new Font("SansSerif", 1, 12));
    categorytextannotation14.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categorytextannotation14.setCategoryAnchor(CategoryAnchor.START);
    categoryplot.addAnnotation(categorytextannotation14);
    return jfreechart;
}

From source file:org.eobjects.datacleaner.util.ChartUtils.java

public static void applyStyles(JFreeChart chart) {
    TextTitle title = chart.getTitle();//from  w ww.j  a v  a  2s  .  c o  m
    if (title != null) {
        title.setFont(WidgetUtils.FONT_HEADER1);
        title.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    }

    for (int i = 0; i < chart.getSubtitleCount(); i++) {
        Title subtitle = chart.getSubtitle(i);
        if (subtitle instanceof TextTitle) {
            ((TextTitle) subtitle).setFont(WidgetUtils.FONT_NORMAL);
        }
    }

    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setItemFont(WidgetUtils.FONT_SMALL);
    }

    // transparent background
    chart.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    chart.setBorderVisible(false);

    final Plot plot = chart.getPlot();
    plot.setInsets(new RectangleInsets(UnitType.ABSOLUTE, 0d, 0d, 0d, 0d));
    plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlineVisible(true);

    if (plot instanceof PiePlot) {
        // tweaks for pie charts
        final PiePlot piePlot = (PiePlot) plot;
        piePlot.setBaseSectionOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setBaseSectionOutlineStroke(normalStroke);
        piePlot.setLabelFont(WidgetUtils.FONT_SMALL);
        piePlot.setLabelBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHT);
        piePlot.setLabelOutlineStroke(normalStroke);
        piePlot.setLabelPaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setSectionOutlinesVisible(false);
        piePlot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
    } else if (plot instanceof CategoryPlot) {
        // tweaks for bar charts
        final CategoryPlot categoryPlot = (CategoryPlot) plot;

        int columnCount = categoryPlot.getDataset().getColumnCount();
        if (columnCount > 1) {
            categoryPlot.setDomainGridlinesVisible(true);
        } else {
            categoryPlot.setDomainGridlinesVisible(false);
        }
        categoryPlot.setDomainGridlinePaint(WidgetUtils.BG_COLOR_DARK);
        categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);

        categoryPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.setDrawingSupplier(new DCDrawingSupplier());

        final CategoryItemRenderer renderer = categoryPlot.getRenderer();
        renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        renderer.setBaseOutlineStroke(wideStroke);

        if (renderer instanceof BarRenderer) {
            BarRenderer barRenderer = (BarRenderer) renderer;
            barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT);
            barRenderer.setBarPainter(new StandardBarPainter());
        }

    } else if (plot instanceof XYPlot) {
        // tweaks for line charts
        final XYPlot xyPlot = (XYPlot) plot;

        xyPlot.setDrawingSupplier(new DCDrawingSupplier());

        xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);

        final XYItemRenderer renderer = xyPlot.getRenderer();
        final int seriesCount = xyPlot.getSeriesCount();
        for (int i = 0; i < seriesCount; i++) {
            renderer.setSeriesStroke(i, wideStroke);
        }
    }
}

From source file:org.datacleaner.util.ChartUtils.java

public static void applyStyles(JFreeChart chart) {
    TextTitle title = chart.getTitle();/*from w  w  w  . jav a  2 s  . c o  m*/
    if (title != null) {
        title.setFont(WidgetUtils.FONT_HEADER1);
        title.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    }

    for (int i = 0; i < chart.getSubtitleCount(); i++) {
        Title subtitle = chart.getSubtitle(i);
        if (subtitle instanceof TextTitle) {
            ((TextTitle) subtitle).setFont(WidgetUtils.FONT_NORMAL);
        }
    }

    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setItemFont(WidgetUtils.FONT_SMALL);
    }

    // transparent background
    chart.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    chart.setBorderVisible(false);

    final Plot plot = chart.getPlot();
    plot.setInsets(new RectangleInsets(UnitType.ABSOLUTE, 0d, 0d, 0d, 0d));
    plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlineVisible(true);

    if (plot instanceof PiePlot) {
        // tweaks for pie charts
        final PiePlot piePlot = (PiePlot) plot;
        piePlot.setBaseSectionOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setBaseSectionOutlineStroke(STROKE_NORMAL);
        piePlot.setLabelFont(WidgetUtils.FONT_SMALL);
        piePlot.setLabelBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHT);
        piePlot.setLabelOutlineStroke(STROKE_NORMAL);
        piePlot.setLabelPaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setSectionOutlinesVisible(false);
        piePlot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
        piePlot.setDrawingSupplier(new DCDrawingSupplier());

    } else if (plot instanceof CategoryPlot) {
        // tweaks for bar charts
        final CategoryPlot categoryPlot = (CategoryPlot) plot;

        int columnCount = categoryPlot.getDataset().getColumnCount();
        if (columnCount > 1) {
            categoryPlot.setDomainGridlinesVisible(true);
        } else {
            categoryPlot.setDomainGridlinesVisible(false);
        }
        categoryPlot.setDomainGridlinePaint(WidgetUtils.BG_COLOR_DARK);
        categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);

        categoryPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.setDrawingSupplier(new DCDrawingSupplier());

        final CategoryItemRenderer renderer = categoryPlot.getRenderer();
        renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        renderer.setBaseOutlineStroke(STROKE_WIDE);

        if (renderer instanceof BarRenderer) {
            BarRenderer barRenderer = (BarRenderer) renderer;
            barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT);
            barRenderer.setBarPainter(new StandardBarPainter());
        }

    } else if (plot instanceof XYPlot) {
        // tweaks for line charts
        final XYPlot xyPlot = (XYPlot) plot;

        xyPlot.setDrawingSupplier(new DCDrawingSupplier());

        xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);

        final XYItemRenderer renderer = xyPlot.getRenderer();
        final int seriesCount = xyPlot.getSeriesCount();
        for (int i = 0; i < seriesCount; i++) {
            renderer.setSeriesStroke(i, STROKE_WIDE);
        }
    }
}

From source file:org.jfree.chart.demo.SurveyResultsDemo.java

/**
 * Creates a chart.//  www . ja  va2s  .c o m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart(null, // chart title
            null, // domain axis label
            null, // range axis label
            dataset, // data
            PlotOrientation.HORIZONTAL, // orientation
            false, // include legend
            true, false);

    chart.setBackgroundPaint(Color.white);

    final TextTitle title = new TextTitle("Figure 7 | I. Resources - The site offers users relevant, "
            + "informative and educational resources");
    title.setHorizontalAlignment(HorizontalAlignment.LEFT);
    title.setBackgroundPaint(Color.red);
    title.setPaint(Color.white);

    chart.setTitle(title);
    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setOutlinePaint(null);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePosition(CategoryAnchor.END);
    plot.setDomainGridlineStroke(new BasicStroke(0.5f));
    plot.setDomainGridlinePaint(Color.black);

    plot.setRangeGridlinesVisible(false);
    plot.clearRangeMarkers();

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setVisible(false);
    domainAxis.setCategoryMargin(0.50);

    plot.getRangeAxis().setVisible(false);

    final CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, new Color(0x9C, 0xA4, 0x4A));
    renderer.setOutlineStroke(null);
    renderer.setBaseOutlineStroke(null);

    renderer.setItemLabelsVisible(true);
    renderer.setItemLabelFont(new Font("SansSerif", Font.BOLD, 10));
    final ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT);
    renderer.setPositiveItemLabelPosition(position);

    final CategoryTextAnnotation a1 = new CategoryTextAnnotation("1. White papers are available.", "Category 1",
            0.0);
    a1.setFont(new Font("SansSerif", Font.BOLD, 12));
    a1.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a1.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a1);

    final CategoryTextAnnotation a2 = new CategoryTextAnnotation(
            "2. White papers enhance users " + "understanding of the firm and its expertise.", "Category 2",
            0.0);
    a2.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a2.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a2.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a2);

    final CategoryTextAnnotation a3 = new CategoryTextAnnotation(
            "3. White papers are relevant to " + "the firm's prospects and clients.", "Category 3", 0.0);
    a3.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a3.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a3.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a3);

    final CategoryTextAnnotation a4 = new CategoryTextAnnotation(
            "4. White papers are relevant to " + "the firm's positioning.", "Category 4", 0.0);
    a4.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a4.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a4.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a4);

    final CategoryTextAnnotation a5 = new CategoryTextAnnotation("5. Case studies are available.", "Category 5",
            0.0);
    a5.setFont(new Font("SansSerif", Font.BOLD, 12));
    a5.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a5.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a5);

    final CategoryTextAnnotation a6 = new CategoryTextAnnotation(
            "6. Case studies enhance users " + "understanding of the firm and its expertise.", "Category 6",
            0.0);
    a6.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a6.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a6.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a6);

    final CategoryTextAnnotation a7 = new CategoryTextAnnotation(
            "7. Case studies are relevant to " + "the firm's prospects and clients.", "Category 7", 0.0);
    a7.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a7.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a7.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a7);

    final CategoryTextAnnotation a8 = new CategoryTextAnnotation(
            "8. White papers are relevant to the firm's positioning.", "Category 8", 0.0);
    a8.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a8.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a8.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a8);

    final CategoryTextAnnotation a9 = new CategoryTextAnnotation("9. Case studies are available.", "Category 9",
            0.0);
    a9.setFont(new Font("SansSerif", Font.BOLD, 12));
    a9.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a9.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a9);

    final CategoryTextAnnotation a10 = new CategoryTextAnnotation(
            "10. Case studies enhance users " + "understanding of the firm and its expertise.", "Category 10",
            0.0);
    a10.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a10.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a10.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a10);

    final CategoryTextAnnotation a11 = new CategoryTextAnnotation(
            "11. Case studies are relevant " + "to the firm's prospects and clients.", "Category 11", 0.0);
    a11.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a11.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a11.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a11);

    final CategoryTextAnnotation a12 = new CategoryTextAnnotation(
            "12. White papers are relevant to the firm's positioning.", "Category 12", 0.0);
    a12.setFont(new Font("SansSerif", Font.PLAIN, 12));
    a12.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a12.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a12);

    final CategoryTextAnnotation a13 = new CategoryTextAnnotation(
            "13. Users can easily access " + "resources based on viewer interest.", "Category 13", 0.0);
    a13.setFont(new Font("SansSerif", Font.BOLD, 12));
    a13.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a13.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a13);

    final CategoryTextAnnotation a14 = new CategoryTextAnnotation(
            "14. Access to additional hyperlinks enhances users's ability to find relevant " + "information.",
            "Category 14", 0.0);
    a14.setFont(new Font("SansSerif", Font.BOLD, 12));
    a14.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a14.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a14);

    final CategoryTextAnnotation a15 = new CategoryTextAnnotation("15. OVERALL EFFECTIVENESS.", "Overall", 0.0);
    a15.setFont(new Font("SansSerif", Font.BOLD, 12));
    a15.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    a15.setCategoryAnchor(CategoryAnchor.START);
    plot.addAnnotation(a15);

    return chart;

}

From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java

/**
 * /*from   w ww . j  a  v  a  2  s  .  c o  m*/
 * @return
 */
private ChartPanel getChartPanel() {

    if (chartPanel == null) {

        renderer = new StackedBarRenderer();
        renderer.setMaximumBarWidth(0.05);
        renderer.setShadowVisible(false);

        renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {
            @Override
            public String generateToolTip(CategoryDataset dataset, int row, int column) {

                WaterfallCategory wfCategory = (WaterfallCategory) dataset.getColumnKey(column);
                return wfCategory.getTooltip();
            }
        });
        renderer.setBaseItemLabelsVisible(true);
        renderer.setBasePositiveItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.INSIDE9, TextAnchor.CENTER_LEFT));
        renderer.setPositiveItemLabelPositionFallback(
                new ItemLabelPosition(ItemLabelAnchor.INSIDE9, TextAnchor.CENTER_LEFT));

        // Set up plot
        CategoryPlot plot = new CategoryPlot(new DefaultCategoryDataset(), getCategoryAxis(), getTimeAxis(),
                renderer);
        plot.setOrientation(PlotOrientation.HORIZONTAL);
        plot.setDomainGridlinesVisible(true);
        plot.setDomainGridlinePosition(CategoryAnchor.END);

        JFreeChart chart = new JFreeChart(plot);
        chartPanel = new ChartPanel(chart, 400, 200, 200, 200, 2000, 5000, true, false, false, false, false,
                true);
        chartPanel.setMouseZoomable(false);
        chartPanel.setRangeZoomable(false);
        chartPanel.setDomainZoomable(false);
        chartPanel.addChartMouseListener(new ChartMouseListener() {

            @Override
            public void chartMouseMoved(ChartMouseEvent arg0) {
                // Do Nothing
            }

            @Override
            public void chartMouseClicked(ChartMouseEvent event) {

                //TODO Add listner info or separate the listener.
                if (event.getEntity() instanceof CategoryItemEntity) {
                    CategoryItemEntity xyitem = (CategoryItemEntity) event.getEntity();
                    WaterfallCategory wfCategory = (WaterfallCategory) xyitem.getColumnKey();
                    if (wfCategory != null && wfCategory.getReqResp() != null) {
                        int count = event.getTrigger().getClickCount();
                        if (count > 1) {
                            waterfallTab.updateMainFrame(wfCategory.getSession());
                        } else {
                            popup.refresh(wfCategory.getReqResp(), wfCategory.getIndex());
                            if (!popup.getPopupDialog().isVisible()) {
                                popup.getPopupDialog().setVisible(true);
                            }
                        }
                    }
                }

            }
        });
    }

    return chartPanel;
}

From source file:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java

/**
 *
 *//* w  w  w.  java  2  s .c  om*/
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
    //      JRBarPlot barPlot = (BarPlot)categoryPlot;
    //      categoryPlot.getDomainAxis().setTickLabelsVisible(
    //            categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
    //            true
    //            );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    List seriesPaints = (List) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
    barRenderer.setSeriesPaint(0, (Paint) seriesPaints.get(3));
    barRenderer.setSeriesPaint(1, (Paint) seriesPaints.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
            //         barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
            //         CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
            //         categoryMarker.setAlpha(0.5f);
            //         categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
        }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java

@Override
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
    //      JRBarPlot barPlot = (BarPlot)categoryPlot;
    //      categoryPlot.getDomainAxis().setTickLabelsVisible(
    //            categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
    //            true
    //            );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    @SuppressWarnings("unchecked")
    List<Paint> seriesPaints = (List<Paint>) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.SERIES_COLORS);
    barRenderer.setSeriesPaint(0, seriesPaints.get(3));
    barRenderer.setSeriesPaint(1, seriesPaints.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
            //         barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
            //         CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
            //         categoryMarker.setAlpha(0.5f);
            //         categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
        }//  w  w w  .j  a  v  a2s . c o  m
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java

/**
 *
 *//* w  w w  . j a  va  2s.co  m*/
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
    categoryPlot.getDomainAxis().setTickLabelsVisible(
            //barPlot.isShowTickLabels()
            true);
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    barRenderer.setSeriesPaint(0, (Paint) ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
    barRenderer.setSeriesPaint(1, (Paint) ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
        }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java

@Override
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
    categoryPlot.getDomainAxis().setTickLabelsVisible(
            //barPlot.isShowTickLabels()
            true);/*from  www.  ja  v  a  2s. c om*/
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    barRenderer.setSeriesPaint(0, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
    barRenderer.setSeriesPaint(1, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
        }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

@SuppressWarnings("unchecked")
public static JFreeChart createTopNBarChart2(String yAxisLabel, CategoryDataset dataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart(null, null, yAxisLabel, dataset,
            PlotOrientation.HORIZONTAL, false, true, false);
    CategoryPlot categoryplot = jfreechart.getCategoryPlot();
    categoryplot.setBackgroundPaint(null);
    categoryplot.setOutlinePaint(null);//  w  ww .j  av a2 s  . co m
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryplot.setDomainGridlineStroke(new BasicStroke(0.5F));
    categoryplot.setDomainGridlinePaint(UIConstants.INTEL_BORDER_GRAY);
    categoryplot.setRangeGridlinesVisible(false);
    categoryplot.clearRangeMarkers();
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setVisible(false);
    categoryaxis.setCategoryMargin(0.75D);

    NumberAxis axis = (NumberAxis) categoryplot.getRangeAxis();
    axis.setRangeType(RangeType.POSITIVE);
    axis.setVisible(false);

    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setShadowVisible(false);
    barrenderer.setSeriesPaint(0, UIConstants.INTEL_BLUE);
    barrenderer.setDrawBarOutline(false);
    barrenderer.setBaseItemLabelsVisible(true);
    barrenderer.setBaseItemLabelFont(UIConstants.H5_FONT);
    barrenderer.setBarPainter(new StandardBarPainter());

    List<String> names = dataset.getColumnKeys();
    for (String name : names) {
        CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation(name, name, 0.0D);
        categorytextannotation.setFont(UIConstants.H6_FONT);
        categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
        categorytextannotation.setCategoryAnchor(CategoryAnchor.MIDDLE);
        categoryplot.addAnnotation(categorytextannotation);
    }
    return jfreechart;
}