Example usage for org.jfree.ui VerticalAlignment TOP

List of usage examples for org.jfree.ui VerticalAlignment TOP

Introduction

In this page you can find the example usage for org.jfree.ui VerticalAlignment TOP.

Prototype

VerticalAlignment TOP

To view the source code for org.jfree.ui VerticalAlignment TOP.

Click Source Link

Document

Top alignment.

Usage

From source file:lisong_mechlab.view.graphs.DpsGraph.java

JFreeChart makechart() {
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("Max DPS over range for " + loadout, "range [m]",
            "damage / second", getSeries(), PlotOrientation.VERTICAL, true, true, false);
    chart.getPlot().setDrawingSupplier(colours);

    chart.getLegend().setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP);

    LegendTitle legendTitle = chart.getLegend();
    XYTitleAnnotation titleAnnotation = new XYTitleAnnotation(0.98, 0.98, legendTitle,
            RectangleAnchor.TOP_RIGHT);//w  ww.  ja v a  2  s . c o  m
    titleAnnotation.setMaxWidth(0.4);
    ((XYPlot) (chart.getPlot())).addAnnotation(titleAnnotation);
    chart.removeLegend();

    return chart;
}

From source file:lisong_mechlab.view.graphs.SustainedDpsGraph.java

JFreeChart makechart() {
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("Max Sustained DPS over range for " + loadout,
            "range [m]", "damage / second", getSeries(), PlotOrientation.VERTICAL, true, true, false);
    chart.getPlot().setDrawingSupplier(colours);

    chart.getLegend().setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP);

    LegendTitle legendTitle = chart.getLegend();
    XYTitleAnnotation titleAnnotation = new XYTitleAnnotation(0.98, 0.98, legendTitle,
            RectangleAnchor.TOP_RIGHT);/*ww w.j  ava2s  .  c om*/
    titleAnnotation.setMaxWidth(0.4);
    ((XYPlot) (chart.getPlot())).addAnnotation(titleAnnotation);
    chart.removeLegend();

    return chart;
}

From source file:lisong_mechlab.view.graphs.DamageGraph.java

/**
 * Creates and displays the {@link DamageGraph}.
 * /*from w  ww . j  a v a  2  s .  com*/
 * @param aLoadout
 *            Which load out the diagram is for.
 * @param anXbar
 *            A {@link MessageXBar} to listen for changes to the loadout on.
 * @param aMaxSustainedDpsMetric
 *            A {@link MaxSustainedDPS} instance to use in calculation.
 */
public DamageGraph(LoadoutBase<?> aLoadout, MessageXBar anXbar, MaxSustainedDPS aMaxSustainedDpsMetric) {
    super("Max Sustained DPS over range for " + aLoadout);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    anXbar.attach(this);

    loadout = aLoadout;
    maxSustainedDPS = aMaxSustainedDpsMetric;
    chartPanel = new ChartPanel(makechart());
    setContentPane(chartPanel);
    chartPanel.getChart().getLegend().setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chartPanel.getChart().getLegend().setVerticalAlignment(VerticalAlignment.TOP);

    LegendTitle legendTitle = chartPanel.getChart().getLegend();
    XYTitleAnnotation titleAnnotation = new XYTitleAnnotation(0.98, 0.98, legendTitle,
            RectangleAnchor.TOP_RIGHT);
    titleAnnotation.setMaxWidth(0.4);
    ((XYPlot) (chartPanel.getChart().getPlot())).addAnnotation(titleAnnotation);
    chartPanel.getChart().removeLegend();

    chartPanel.setLayout(new OverlayLayout(chartPanel));
    JButton button = new JButton(
            new OpenHelp("What is this?", "Max-sustained-dps-graph", KeyStroke.getKeyStroke('w')));
    button.setMargin(new Insets(10, 10, 10, 10));
    button.setFocusable(false);
    button.setAlignmentX(Component.RIGHT_ALIGNMENT);
    button.setAlignmentY(Component.BOTTOM_ALIGNMENT);
    chartPanel.add(button);

    setIconImage(ProgramInit.programIcon);
    setSize(800, 600);
    setVisible(true);
}

From source file:PlotsBuilding.PlotPanel.java

private JFreeChart createChart(XYDataset xyDataset, ArrayList<Integer> seriesCount, double y1, double y2) {

    NumberAxis domainAxis = new NumberAxis("x");
    domainAxis.setAutoRangeIncludesZero(false);
    domainAxis.setPositiveArrowVisible(true);
    NumberAxis rangeAxis = new NumberAxis("y");
    rangeAxis.setRange(y1, y2);/*from w  w  w .  j a v a 2s  .  c om*/
    rangeAxis.setPositiveArrowVisible(true);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    int start = 0;
    int color = 50;
    for (Object series : seriesCount) {
        for (int i = start; i < start + (int) series; i++) {
            Color s = new Color(color);
            renderer.setSeriesPaint(i, s);
            renderer.setSeriesVisibleInLegend(i, false);
            renderer.setSeriesVisibleInLegend(start, true);
        }
        start = start + (int) series;
        color *= 100;
    }
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    XYPlot plot = new XYPlot(xyDataset, domainAxis, rangeAxis, renderer);
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    plot.setOrientation(orientation);
    plot.setBackgroundPaint(Color.white);
    chart = new JFreeChart(plot);
    chart.setBackgroundPaint(Color.white);
    chart.getLegend().setPosition(RectangleEdge.RIGHT);
    chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP);
    return chart;
}

From source file:org.codehaus.mojo.dashboard.report.plugin.chart.time.MarkerTimeChartDecorator.java

/**
 * Creates a legend item block./*from w  w w . j a  va  2 s.co m*/
 * 
 * @param item
 *            the legend item.
 * 
 * @return The block.
 */
protected void createLegendBlock(BlockContainer blockcontainerLabel) {

    XYPlot xyplot = (XYPlot) report.getPlot();

    int nbRenderer = xyplot.getDatasetCount();
    BlockContainer blockcontainer = new BlockContainer(new BorderArrangement());
    if (nbRenderer > 1) {
        BlockContainer oldLegendBlockContainer = new BlockContainer(
                new FlowArrangement(HorizontalAlignment.LEFT, VerticalAlignment.TOP, 2.0D, 2.0D));
        for (int i = 0; i < nbRenderer; i++) {
            LegendTitle legendtitle = new LegendTitle(xyplot.getRenderer(i));
            legendtitle.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
            legendtitle.setFrame(new LineBorder());
            legendtitle.setBackgroundPaint(ChartColor.WHITE);
            oldLegendBlockContainer.add(legendtitle);
        }

        blockcontainer.add(oldLegendBlockContainer, RectangleEdge.LEFT);
    } else {
        LegendTitle legendtitle = new LegendTitle(xyplot.getRenderer(0));
        legendtitle.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
        legendtitle.setFrame(new LineBorder());
        legendtitle.setBackgroundPaint(ChartColor.WHITE);
        blockcontainer.add(legendtitle, RectangleEdge.LEFT);
    }

    LegendTitle legendtitle1 = new LegendTitle(xyplot.getRenderer());
    legendtitle1.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
    legendtitle1.setFrame(new LineBorder());
    legendtitle1.setBackgroundPaint(ChartColor.WHITE);
    legendtitle1.setWrapper(blockcontainerLabel);

    blockcontainer.add(legendtitle1, RectangleEdge.RIGHT);
    blockcontainer.add(new EmptyBlock(1000D, 0.0D));

    CompositeTitle compositetitle = new CompositeTitle(blockcontainer);
    compositetitle.setPosition(RectangleEdge.BOTTOM);
    report.clearSubtitles();
    report.addSubtitle(compositetitle);
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleSettingsFactory.java

/**
 *
 *///w w  w  .j a v  a  2 s . c  o m
public static final ChartThemeSettings createChartThemeSettings() {
    ChartThemeSettings settings = new ChartThemeSettings();

    ChartSettings chartSettings = settings.getChartSettings();
    chartSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    chartSettings.setBackgroundImage(new FileImageProvider("net/sf/fspdfs/chartthemes/simple/fspdfs.png"));
    chartSettings.setBackgroundImageAlignment(new Integer(Align.TOP_RIGHT));
    chartSettings.setBackgroundImageAlpha(new Float(1f));
    chartSettings.setBorderVisible(Boolean.TRUE);
    chartSettings.setBorderPaint(new ColorProvider(Color.GREEN));
    chartSettings.setBorderStroke(new BasicStroke(1f));
    chartSettings.setAntiAlias(Boolean.TRUE);
    chartSettings.setTextAntiAlias(Boolean.TRUE);
    chartSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    TitleSettings titleSettings = settings.getTitleSettings();
    titleSettings.setShowTitle(Boolean.TRUE);
    titleSettings.setPosition(EdgeEnum.TOP);
    titleSettings.setForegroundPaint(new ColorProvider(Color.black));
    titleSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    titleSettings.getFont().setBold(Boolean.TRUE);
    titleSettings.getFont().setFontSize(22);
    titleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    titleSettings.setVerticalAlignment(VerticalAlignment.TOP);
    titleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    TitleSettings subtitleSettings = settings.getSubtitleSettings();
    subtitleSettings.setShowTitle(Boolean.TRUE);
    subtitleSettings.setPosition(EdgeEnum.TOP);
    subtitleSettings.setForegroundPaint(new ColorProvider(Color.red));
    subtitleSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    subtitleSettings.getFont().setBold(Boolean.TRUE);
    subtitleSettings.setHorizontalAlignment(HorizontalAlignment.LEFT);
    subtitleSettings.setVerticalAlignment(VerticalAlignment.CENTER);
    subtitleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    LegendSettings legendSettings = settings.getLegendSettings();
    legendSettings.setShowLegend(Boolean.TRUE);
    legendSettings.setPosition(EdgeEnum.BOTTOM);
    legendSettings.setForegroundPaint(new ColorProvider(Color.black));
    legendSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    legendSettings.getFont().setBold(Boolean.TRUE);
    legendSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    legendSettings.setVerticalAlignment(VerticalAlignment.BOTTOM);
    //FIXMETHEME legendSettings.setBlockFrame();
    legendSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    PlotSettings plotSettings = settings.getPlotSettings();
    plotSettings.setOrientation(PlotOrientation.VERTICAL);
    //      plotSettings.setForegroundAlpha(new Float(0.5f));
    plotSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    //      plotSettings.setBackgroundAlpha(new Float(0.5f));
    plotSettings.setBackgroundImage(new FileImageProvider("net/sf/fspdfs/chartthemes/simple/fspdfs.png"));
    plotSettings.setBackgroundImageAlpha(new Float(0.5f));
    plotSettings.setBackgroundImageAlignment(new Integer(Align.NORTH_WEST));
    plotSettings.setLabelRotation(new Double(0));
    plotSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));
    plotSettings.setOutlineVisible(Boolean.TRUE);
    plotSettings.setOutlinePaint(new ColorProvider(Color.red));
    plotSettings.setOutlineStroke(new BasicStroke(1f));
    plotSettings.setSeriesColorSequence(COLORS);
    //      plotSettings.setSeriesGradientPaintSequence(GRADIENT_PAINTS);
    plotSettings.setSeriesOutlinePaintSequence(COLORS_DARKER);
    plotSettings.setSeriesStrokeSequence(STROKES);
    plotSettings.setSeriesOutlineStrokeSequence(OUTLINE_STROKES);
    plotSettings.setDomainGridlineVisible(Boolean.TRUE);
    plotSettings.setDomainGridlinePaint(new ColorProvider(Color.DARK_GRAY));
    plotSettings.setDomainGridlineStroke(new BasicStroke(0.5f));
    plotSettings.setRangeGridlineVisible(Boolean.TRUE);
    plotSettings.setRangeGridlinePaint(new ColorProvider(Color.BLACK));
    plotSettings.setRangeGridlineStroke(new BasicStroke(0.5f));
    plotSettings.getTickLabelFont().setFontName("Courier");
    plotSettings.getTickLabelFont().setBold(Boolean.TRUE);
    plotSettings.getTickLabelFont().setFontSize(10);
    plotSettings.getDisplayFont().setFontName("Arial");
    plotSettings.getDisplayFont().setBold(Boolean.TRUE);
    plotSettings.getDisplayFont().setFontSize(12);

    AxisSettings domainAxisSettings = settings.getDomainAxisSettings();
    domainAxisSettings.setVisible(Boolean.TRUE);
    domainAxisSettings.setLocation(AxisLocation.BOTTOM_OR_RIGHT);
    domainAxisSettings.setLinePaint(new ColorProvider(Color.green));
    domainAxisSettings.setLineStroke(new BasicStroke(1f));
    domainAxisSettings.setLineVisible(Boolean.TRUE);
    //      domainAxisSettings.setLabel("Domain Axis");
    domainAxisSettings.setLabelAngle(new Double(0.0));
    domainAxisSettings.setLabelPaint(new ColorProvider(Color.magenta));
    domainAxisSettings.getLabelFont().setBold(Boolean.TRUE);
    domainAxisSettings.getLabelFont().setItalic(Boolean.TRUE);
    domainAxisSettings.getLabelFont().setFontName("Comic Sans MS");
    domainAxisSettings.getLabelFont().setFontSize(12);
    domainAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1));
    domainAxisSettings.setLabelVisible(Boolean.TRUE);
    domainAxisSettings.setTickLabelPaint(new ColorProvider(Color.cyan));
    domainAxisSettings.getTickLabelFont().setBold(Boolean.TRUE);
    domainAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE);
    domainAxisSettings.getTickLabelFont().setFontName("Arial");
    domainAxisSettings.getTickLabelFont().setFontSize(10);
    domainAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5));
    domainAxisSettings.setTickLabelsVisible(Boolean.TRUE);
    domainAxisSettings.setTickMarksInsideLength(new Float(0.1f));
    domainAxisSettings.setTickMarksOutsideLength(new Float(0.2f));
    domainAxisSettings.setTickMarksPaint(new ColorProvider(Color.ORANGE));
    domainAxisSettings.setTickMarksStroke(new BasicStroke(1f));
    domainAxisSettings.setTickMarksVisible(Boolean.TRUE);
    domainAxisSettings.setTickCount(new Integer(5));

    AxisSettings rangeAxisSettings = settings.getRangeAxisSettings();
    rangeAxisSettings.setVisible(Boolean.TRUE);
    rangeAxisSettings.setLocation(AxisLocation.TOP_OR_RIGHT);
    rangeAxisSettings.setLinePaint(new ColorProvider(Color.yellow));
    rangeAxisSettings.setLineStroke(new BasicStroke(1f));
    rangeAxisSettings.setLineVisible(Boolean.TRUE);
    //      rangeAxisSettings.setLabel("Range Axis");
    rangeAxisSettings.setLabelAngle(new Double(Math.PI / 2.0));
    rangeAxisSettings.setLabelPaint(new ColorProvider(Color.green));
    rangeAxisSettings.getLabelFont().setBold(Boolean.TRUE);
    rangeAxisSettings.getLabelFont().setItalic(Boolean.TRUE);
    rangeAxisSettings.getLabelFont().setFontName("Comic Sans MS");
    rangeAxisSettings.getLabelFont().setFontSize(12);
    rangeAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1));
    rangeAxisSettings.setLabelVisible(Boolean.TRUE);
    rangeAxisSettings.setTickLabelPaint(new ColorProvider(Color.pink));
    rangeAxisSettings.getTickLabelFont().setBold(Boolean.FALSE);
    rangeAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE);
    rangeAxisSettings.getTickLabelFont().setFontName("Arial");
    rangeAxisSettings.getTickLabelFont().setFontSize(10);
    rangeAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5));
    rangeAxisSettings.setTickLabelsVisible(Boolean.TRUE);
    rangeAxisSettings.setTickMarksInsideLength(new Float(0.2f));
    rangeAxisSettings.setTickMarksOutsideLength(new Float(0.1f));
    rangeAxisSettings.setTickMarksPaint(new ColorProvider(Color.black));
    rangeAxisSettings.setTickMarksStroke(new BasicStroke(1f));
    rangeAxisSettings.setTickMarksVisible(Boolean.TRUE);
    rangeAxisSettings.setTickCount(new Integer(6));

    return settings;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleSettingsFactory.java

/**
 *
 *//*from  w w w .ja v a 2 s.co  m*/
public static final ChartThemeSettings createChartThemeSettings() {
    ChartThemeSettings settings = new ChartThemeSettings();

    ChartSettings chartSettings = settings.getChartSettings();
    chartSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    chartSettings.setBackgroundImage(
            new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png"));
    chartSettings.setBackgroundImageAlignment(Align.TOP_RIGHT);
    chartSettings.setBackgroundImageAlpha(1f);
    chartSettings.setBorderVisible(Boolean.TRUE);
    chartSettings.setBorderPaint(new ColorProvider(Color.GREEN));
    chartSettings.setBorderStroke(new BasicStroke(1f));
    chartSettings.setAntiAlias(Boolean.TRUE);
    chartSettings.setTextAntiAlias(Boolean.TRUE);
    chartSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    TitleSettings titleSettings = settings.getTitleSettings();
    titleSettings.setShowTitle(Boolean.TRUE);
    titleSettings.setPosition(EdgeEnum.TOP);
    titleSettings.setForegroundPaint(new ColorProvider(Color.black));
    titleSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    titleSettings.getFont().setBold(Boolean.TRUE);
    titleSettings.getFont().setFontSize(22f);
    titleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    titleSettings.setVerticalAlignment(VerticalAlignment.TOP);
    titleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    TitleSettings subtitleSettings = settings.getSubtitleSettings();
    subtitleSettings.setShowTitle(Boolean.TRUE);
    subtitleSettings.setPosition(EdgeEnum.TOP);
    subtitleSettings.setForegroundPaint(new ColorProvider(Color.red));
    subtitleSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    subtitleSettings.getFont().setBold(Boolean.TRUE);
    subtitleSettings.setHorizontalAlignment(HorizontalAlignment.LEFT);
    subtitleSettings.setVerticalAlignment(VerticalAlignment.CENTER);
    subtitleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    LegendSettings legendSettings = settings.getLegendSettings();
    legendSettings.setShowLegend(Boolean.TRUE);
    legendSettings.setPosition(EdgeEnum.BOTTOM);
    legendSettings.setForegroundPaint(new ColorProvider(Color.black));
    legendSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    legendSettings.getFont().setBold(Boolean.TRUE);
    legendSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    legendSettings.setVerticalAlignment(VerticalAlignment.BOTTOM);
    //FIXMETHEME legendSettings.setBlockFrame();
    legendSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    PlotSettings plotSettings = settings.getPlotSettings();
    plotSettings.setOrientation(PlotOrientation.VERTICAL);
    //      plotSettings.setForegroundAlpha(0.5f);
    plotSettings.setBackgroundPaint(new GradientPaintProvider(Color.green, Color.blue));
    //      plotSettings.setBackgroundAlpha(0.5f);
    plotSettings.setBackgroundImage(
            new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png"));
    plotSettings.setBackgroundImageAlpha(0.5f);
    plotSettings.setBackgroundImageAlignment(Align.NORTH_WEST);
    plotSettings.setLabelRotation(0d);
    plotSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));
    plotSettings.setOutlineVisible(Boolean.TRUE);
    plotSettings.setOutlinePaint(new ColorProvider(Color.red));
    plotSettings.setOutlineStroke(new BasicStroke(1f));
    plotSettings.setSeriesColorSequence(COLORS);
    //      plotSettings.setSeriesGradientPaintSequence(GRADIENT_PAINTS);
    plotSettings.setSeriesOutlinePaintSequence(COLORS_DARKER);
    plotSettings.setSeriesStrokeSequence(STROKES);
    plotSettings.setSeriesOutlineStrokeSequence(OUTLINE_STROKES);
    plotSettings.setDomainGridlineVisible(Boolean.TRUE);
    plotSettings.setDomainGridlinePaint(new ColorProvider(Color.DARK_GRAY));
    plotSettings.setDomainGridlineStroke(new BasicStroke(0.5f));
    plotSettings.setRangeGridlineVisible(Boolean.TRUE);
    plotSettings.setRangeGridlinePaint(new ColorProvider(Color.BLACK));
    plotSettings.setRangeGridlineStroke(new BasicStroke(0.5f));
    plotSettings.getTickLabelFont().setFontName("Courier");
    plotSettings.getTickLabelFont().setBold(Boolean.TRUE);
    plotSettings.getTickLabelFont().setFontSize(10f);
    plotSettings.getDisplayFont().setFontName("Arial");
    plotSettings.getDisplayFont().setBold(Boolean.TRUE);
    plotSettings.getDisplayFont().setFontSize(12f);

    AxisSettings domainAxisSettings = settings.getDomainAxisSettings();
    domainAxisSettings.setVisible(Boolean.TRUE);
    domainAxisSettings.setLocation(AxisLocation.BOTTOM_OR_RIGHT);
    domainAxisSettings.setLinePaint(new ColorProvider(Color.green));
    domainAxisSettings.setLineStroke(new BasicStroke(1f));
    domainAxisSettings.setLineVisible(Boolean.TRUE);
    //      domainAxisSettings.setLabel("Domain Axis");
    domainAxisSettings.setLabelAngle(0.0d);
    domainAxisSettings.setLabelPaint(new ColorProvider(Color.magenta));
    domainAxisSettings.getLabelFont().setBold(Boolean.TRUE);
    domainAxisSettings.getLabelFont().setItalic(Boolean.TRUE);
    domainAxisSettings.getLabelFont().setFontName("Comic Sans MS");
    domainAxisSettings.getLabelFont().setFontSize(12f);
    domainAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1));
    domainAxisSettings.setLabelVisible(Boolean.TRUE);
    domainAxisSettings.setTickLabelPaint(new ColorProvider(Color.cyan));
    domainAxisSettings.getTickLabelFont().setBold(Boolean.TRUE);
    domainAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE);
    domainAxisSettings.getTickLabelFont().setFontName("Arial");
    domainAxisSettings.getTickLabelFont().setFontSize(10f);
    domainAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5));
    domainAxisSettings.setTickLabelsVisible(Boolean.TRUE);
    domainAxisSettings.setTickMarksInsideLength(0.1f);
    domainAxisSettings.setTickMarksOutsideLength(0.2f);
    domainAxisSettings.setTickMarksPaint(new ColorProvider(Color.ORANGE));
    domainAxisSettings.setTickMarksStroke(new BasicStroke(1f));
    domainAxisSettings.setTickMarksVisible(Boolean.TRUE);
    domainAxisSettings.setTickCount(5);

    AxisSettings rangeAxisSettings = settings.getRangeAxisSettings();
    rangeAxisSettings.setVisible(Boolean.TRUE);
    rangeAxisSettings.setLocation(AxisLocation.TOP_OR_RIGHT);
    rangeAxisSettings.setLinePaint(new ColorProvider(Color.yellow));
    rangeAxisSettings.setLineStroke(new BasicStroke(1f));
    rangeAxisSettings.setLineVisible(Boolean.TRUE);
    //      rangeAxisSettings.setLabel("Range Axis");
    rangeAxisSettings.setLabelAngle(Math.PI / 2.0d);
    rangeAxisSettings.setLabelPaint(new ColorProvider(Color.green));
    rangeAxisSettings.getLabelFont().setBold(Boolean.TRUE);
    rangeAxisSettings.getLabelFont().setItalic(Boolean.TRUE);
    rangeAxisSettings.getLabelFont().setFontName("Comic Sans MS");
    rangeAxisSettings.getLabelFont().setFontSize(12f);
    rangeAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1));
    rangeAxisSettings.setLabelVisible(Boolean.TRUE);
    rangeAxisSettings.setTickLabelPaint(new ColorProvider(Color.pink));
    rangeAxisSettings.getTickLabelFont().setBold(Boolean.FALSE);
    rangeAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE);
    rangeAxisSettings.getTickLabelFont().setFontName("Arial");
    rangeAxisSettings.getTickLabelFont().setFontSize(10f);
    rangeAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5));
    rangeAxisSettings.setTickLabelsVisible(Boolean.TRUE);
    rangeAxisSettings.setTickMarksInsideLength(0.2f);
    rangeAxisSettings.setTickMarksOutsideLength(0.1f);
    rangeAxisSettings.setTickMarksPaint(new ColorProvider(Color.black));
    rangeAxisSettings.setTickMarksStroke(new BasicStroke(1f));
    rangeAxisSettings.setTickMarksVisible(Boolean.TRUE);
    rangeAxisSettings.setTickCount(6);

    return settings;
}

From source file:com.jaspersoft.studio.components.chart.editor.wizard.BaseSettingsFactory.java

/**
 *
 *//*from   ww  w  .ja v  a2s .co m*/
public static final ChartThemeSettings createChartThemeSettings() {
    ChartThemeSettings settings = new ChartThemeSettings();

    ChartSettings chartSettings = settings.getChartSettings();
    chartSettings.setBackgroundPaint(new GradientPaintProvider(CHART_BACKGROUND1, CHART_BACKGROUND2));
    chartSettings.setBackgroundImage(
            new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png"));
    chartSettings.setBackgroundImageAlignment(new Integer(Align.TOP_RIGHT));
    chartSettings.setBackgroundImageAlpha(new Float(1f));
    chartSettings.setBorderVisible(Boolean.FALSE);
    chartSettings.setBorderPaint(new ColorProvider(Color.BLACK));
    chartSettings.setBorderStroke(new BasicStroke(1f));
    chartSettings.setAntiAlias(Boolean.TRUE);
    chartSettings.setTextAntiAlias(Boolean.TRUE);
    chartSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    TitleSettings titleSettings = settings.getTitleSettings();
    titleSettings.setShowTitle(Boolean.TRUE);
    titleSettings.setPosition(EdgeEnum.TOP);
    titleSettings.setForegroundPaint(new ColorProvider(Color.black));
    titleSettings.setBackgroundPaint(new ColorProvider(TITLE_BACKGROUND));
    titleSettings.getFont().setBold(Boolean.TRUE);
    titleSettings.getFont().setFontSize(22);
    titleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    titleSettings.setVerticalAlignment(VerticalAlignment.TOP);
    titleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    TitleSettings subtitleSettings = settings.getSubtitleSettings();
    subtitleSettings.setShowTitle(Boolean.TRUE);
    subtitleSettings.setPosition(EdgeEnum.TOP);
    subtitleSettings.setForegroundPaint(new ColorProvider(Color.BLACK));
    subtitleSettings.setBackgroundPaint(new ColorProvider(SUBTITLE_BACKGROUND));
    subtitleSettings.getFont().setBold(Boolean.TRUE);
    subtitleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    subtitleSettings.setVerticalAlignment(VerticalAlignment.TOP);
    subtitleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    LegendSettings legendSettings = settings.getLegendSettings();
    legendSettings.setShowLegend(Boolean.TRUE);
    legendSettings.setPosition(EdgeEnum.BOTTOM);
    legendSettings.setForegroundPaint(new ColorProvider(Color.black));
    legendSettings.setBackgroundPaint(new ColorProvider(Color.white));
    legendSettings.getFont().setBold(Boolean.TRUE);
    legendSettings.getFont().setFontSize(7);
    legendSettings.setHorizontalAlignment(HorizontalAlignment.CENTER);
    legendSettings.setVerticalAlignment(VerticalAlignment.BOTTOM);
    //FIXMETHEME legendSettings.setBlockFrame();
    legendSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));

    PlotSettings plotSettings = settings.getPlotSettings();
    plotSettings.setOrientation(PlotOrientation.VERTICAL);
    //      plotSettings.setForegroundAlpha(new Float(0.5f));
    plotSettings.setBackgroundPaint(new ColorProvider(Color.white));
    plotSettings.setBackgroundAlpha(new Float(0.0f));
    plotSettings.setBackgroundImage(
            new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png"));
    plotSettings.setBackgroundImageAlpha(new Float(0.5f));
    plotSettings.setBackgroundImageAlignment(new Integer(Align.NORTH_WEST));
    plotSettings.setLabelRotation(new Double(0));
    plotSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4));
    plotSettings.setOutlineVisible(Boolean.TRUE);
    plotSettings.setOutlinePaint(new ColorProvider(Color.BLACK));
    plotSettings.setOutlineStroke(new BasicStroke(1f));
    plotSettings.setSeriesColorSequence(COLORS);
    //      plotSettings.setSeriesGradientPaintSequence(GRADIENT_PAINTS);
    plotSettings.setSeriesOutlinePaintSequence(COLORS_DARKER);
    plotSettings.setSeriesStrokeSequence(STROKES);
    plotSettings.setSeriesOutlineStrokeSequence(OUTLINE_STROKES);
    plotSettings.setDomainGridlineVisible(Boolean.TRUE);
    plotSettings.setDomainGridlinePaint(new ColorProvider(Color.BLACK));
    plotSettings.setDomainGridlineStroke(new BasicStroke(0.5f));
    plotSettings.setRangeGridlineVisible(Boolean.TRUE);
    plotSettings.setRangeGridlinePaint(new ColorProvider(Color.BLACK));
    plotSettings.setRangeGridlineStroke(new BasicStroke(0.5f));
    plotSettings.getTickLabelFont().setFontName("Arial");
    plotSettings.getTickLabelFont().setBold(Boolean.TRUE);
    plotSettings.getTickLabelFont().setFontSize(10);
    plotSettings.getDisplayFont().setFontName("Arial");
    plotSettings.getDisplayFont().setBold(Boolean.TRUE);
    plotSettings.getDisplayFont().setFontSize(12);

    AxisSettings domainAxisSettings = settings.getDomainAxisSettings();
    domainAxisSettings.setVisible(Boolean.TRUE);
    domainAxisSettings.setLocation(AxisLocation.BOTTOM_OR_RIGHT);
    domainAxisSettings.setLinePaint(new ColorProvider(Color.white));
    domainAxisSettings.setLineStroke(new BasicStroke(1f));
    domainAxisSettings.setLineVisible(Boolean.TRUE);
    //      domainAxisSettings.setLabel("Domain Axis");
    domainAxisSettings.setLabelAngle(new Double(0.0));
    domainAxisSettings.setLabelPaint(new ColorProvider(Color.black));
    domainAxisSettings.getLabelFont().setBold(Boolean.TRUE);
    domainAxisSettings.getLabelFont().setItalic(Boolean.FALSE);
    domainAxisSettings.getLabelFont().setFontName("Times New Roman");
    domainAxisSettings.getLabelFont().setFontSize(10);
    domainAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1));
    domainAxisSettings.setLabelVisible(Boolean.TRUE);
    domainAxisSettings.setTickLabelPaint(new ColorProvider(Color.cyan));
    domainAxisSettings.getTickLabelFont().setBold(Boolean.TRUE);
    domainAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE);
    domainAxisSettings.getTickLabelFont().setFontName("Times New Roman");
    domainAxisSettings.getTickLabelFont().setFontSize(7);
    domainAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE);
    domainAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5));
    domainAxisSettings.setTickLabelsVisible(Boolean.TRUE);
    domainAxisSettings.setTickMarksInsideLength(new Float(0.1f));
    domainAxisSettings.setTickMarksOutsideLength(new Float(0.2f));
    domainAxisSettings.setTickMarksPaint(new ColorProvider(Color.black));
    domainAxisSettings.setTickMarksStroke(new BasicStroke(1f));
    domainAxisSettings.setTickMarksVisible(Boolean.TRUE);
    domainAxisSettings.setTickCount(new Integer(5));

    AxisSettings rangeAxisSettings = settings.getRangeAxisSettings();
    rangeAxisSettings.setVisible(Boolean.TRUE);
    rangeAxisSettings.setLocation(AxisLocation.TOP_OR_RIGHT);
    rangeAxisSettings.setLinePaint(new ColorProvider(Color.white));
    rangeAxisSettings.setLineStroke(new BasicStroke(1f));
    rangeAxisSettings.setLineVisible(Boolean.TRUE);
    //      rangeAxisSettings.setLabel("Range Axis");
    rangeAxisSettings.setLabelAngle(new Double(Math.PI / 2.0));
    rangeAxisSettings.setLabelPaint(new ColorProvider(Color.black));
    rangeAxisSettings.getLabelFont().setBold(Boolean.TRUE);
    rangeAxisSettings.getLabelFont().setItalic(Boolean.FALSE);
    rangeAxisSettings.getLabelFont().setFontName("Times New Roman");
    rangeAxisSettings.getLabelFont().setFontSize(10);
    rangeAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1));
    rangeAxisSettings.setLabelVisible(Boolean.TRUE);
    rangeAxisSettings.setTickLabelPaint(new ColorProvider(Color.pink));
    rangeAxisSettings.getTickLabelFont().setBold(Boolean.FALSE);
    rangeAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE);
    rangeAxisSettings.getTickLabelFont().setFontName("Times New Roman");
    rangeAxisSettings.getTickLabelFont().setFontSize(7);
    rangeAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE);
    rangeAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5));
    rangeAxisSettings.setTickLabelsVisible(Boolean.TRUE);
    rangeAxisSettings.setTickMarksInsideLength(new Float(0.2f));
    rangeAxisSettings.setTickMarksOutsideLength(new Float(0.1f));
    rangeAxisSettings.setTickMarksPaint(new ColorProvider(Color.black));
    rangeAxisSettings.setTickMarksStroke(new BasicStroke(1f));
    rangeAxisSettings.setTickMarksVisible(Boolean.TRUE);
    rangeAxisSettings.setTickCount(new Integer(6));

    return settings;
}

From source file:org.toobsframework.pres.chart.ChartUtil.java

public static VerticalAlignment getVerticalAlignment(SubtitleVerticalAlignmentType verticalAlignment) {
    VerticalAlignment valign = null;// ww w. jav a  2 s  . co  m
    switch (verticalAlignment.getType()) {
    case SubtitleVerticalAlignmentType.TOP_TYPE:
        valign = VerticalAlignment.TOP;
        break;
    case SubtitleVerticalAlignmentType.BOTTOM_TYPE:
        valign = VerticalAlignment.BOTTOM;
        break;
    case SubtitleVerticalAlignmentType.CENTER_TYPE:
        valign = VerticalAlignment.CENTER;
        break;
    }
    return valign;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.linecharts.LineChart.java

public JFreeChart createChart() {

    logger.debug("IN");
    CategoryPlot plot = new CategoryPlot();

    NumberAxis rangeAxis = new NumberAxis("Kpi Values");
    rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 12));
    Color colorLabel = Color.decode("#000000");
    rangeAxis.setLabelPaint(colorLabel);
    rangeAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10));
    rangeAxis.setTickLabelPaint(colorLabel);
    plot.setRangeAxis(rangeAxis);/*  ww  w. j a v  a2 s .  c o m*/

    CategoryAxis domainAxis = new CategoryAxis();
    domainAxis.setLabelFont(new Font("Arial", Font.PLAIN, 10));
    domainAxis.setLabelPaint(colorLabel);
    domainAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10));
    domainAxis.setTickLabelPaint(colorLabel);
    plot.setDomainAxis(domainAxis);

    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);

    //I create a line renderer 
    MyStandardCategoryItemLabelGenerator generator = null;

    LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
    lineRenderer.setShapesFilled(true);
    lineRenderer.setBaseItemLabelGenerator(generator);
    lineRenderer.setBaseItemLabelFont(new Font("Arial", Font.PLAIN, 12));
    lineRenderer.setBaseItemLabelPaint(colorLabel);
    lineRenderer.setBaseItemLabelsVisible(true);

    DefaultCategoryDataset datasetLine = (DefaultCategoryDataset) datasetMap.getDatasets().get("line");

    for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) {
        String serName = (String) iterator.next();
        String labelName = "";
        int index = -1;
        index = datasetLine.getRowIndex(serName);

        Color color = Color.decode("#990200");
        lineRenderer.setSeriesPaint(index, color);
    }

    plot.setDataset(0, datasetLine);
    plot.setRenderer(0, lineRenderer);

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    JFreeChart chart = new JFreeChart(plot);
    logger.debug("Chart created");
    TextTitle title = new TextTitle(name, new Font("Arial", Font.BOLD, 16), Color.decode("#990200"),
            RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
    chart.setTitle(title);
    TextTitle subTitle = new TextTitle(subName, new Font("Arial", Font.PLAIN, 12), Color.decode("#000000"),
            RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
    chart.addSubtitle(subTitle);
    TextTitle subTitle2 = new TextTitle(subName, new Font("Arial", Font.PLAIN, 8), Color.decode("#FFFFFF"),
            RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
    chart.addSubtitle(subTitle2);
    chart.removeLegend();

    chart.setBackgroundPaint(Color.white);
    logger.debug("OUT");
    return chart;
}