Example usage for org.jfree.eastwood GXYPlot GXYPlot

List of usage examples for org.jfree.eastwood GXYPlot GXYPlot

Introduction

In this page you can find the example usage for org.jfree.eastwood GXYPlot GXYPlot.

Prototype

public GXYPlot() 

Source Link

Document

Default constructor.

Usage

From source file:org.jfree.eastwood.ChartEngine.java

/**
 * Creates a line chart.//www  .j  a  va  2s.co m
 *
 * @return A line chart.
 */
private static JFreeChart createLineChart() {
    GXYPlot plot = new GXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseShapesVisible(false);
    plot.setRenderer(renderer);
    JFreeChart chart = new JFreeChart(plot);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);
    renderer.setBasePaint(new Color(0xFF9900));
    renderer.setBaseStroke(new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));

    renderer.setAutoPopulateSeriesPaint(false);
    renderer.setItemLabelsVisible(true);
    renderer.setItemLabelGenerator(new GXYPlot.LabelGenerator());
    renderer.setItemLabelPaint(new Color(0x333435));

    renderer.setPositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT));

    GValueAxis xAxis = new GValueAxis();
    xAxis.setTickLabelsVisible(false);
    xAxis.setTickMarksVisible(false);
    plot.setDomainAxis(xAxis);
    GValueAxis yAxis = new GValueAxis();
    yAxis.setTickLabelsVisible(false);
    yAxis.setTickMarksVisible(false);
    plot.setRangeAxis(yAxis);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    return chart;
}

From source file:org.jfree.eastwood.ChartEngine.java

/**
 * Creates a sparkline chart./*w  w  w.ja v a2s  .  co m*/
 *
 * @return A sparkline chart.
 */
private static JFreeChart createSparklineChart() {
    GXYPlot plot = new GXYPlot();
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseShapesVisible(false);
    plot.setRenderer(renderer);
    JFreeChart chart = new JFreeChart(plot);
    chart.setPadding(RectangleInsets.ZERO_INSETS);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);
    renderer.setBasePaint(new Color(0xFF9900));
    renderer.setBaseStroke(new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    renderer.setAutoPopulateSeriesPaint(false);

    GValueAxis xAxis = new GValueAxis();
    xAxis.setVisible(false);
    plot.setDomainAxis(xAxis);
    GValueAxis yAxis = new GValueAxis();
    yAxis.setVisible(false);
    plot.setRangeAxis(yAxis);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    return chart;
}