Example usage for org.jfree.chart JFreeChart setTextAntiAlias

List of usage examples for org.jfree.chart JFreeChart setTextAntiAlias

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart setTextAntiAlias.

Prototype

public void setTextAntiAlias(Object val) 

Source Link

Document

Sets the value in the rendering hints table for RenderingHints#KEY_TEXT_ANTIALIASING and sends a ChartChangeEvent to all registered listeners.

Usage

From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsQuantilesChart.java

public JFreeChart createChart() {
    XYPlot plot = new XYPlot();
    ValueAxis xAxis = this.axisBuilder.createValueAxis("% of Population Sorted by Income");
    xAxis.setRange(0.0, 102.0);/*from   w  ww .ja v a 2s.  c o m*/
    ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]");
    yAxis.setRange(-0.05, 0.3);
    //      xAxis.setVisible(false);
    //      xAxis.setFixedAutoRange(1.0);
    plot.setDomainAxis(xAxis);
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, true);
    renderer2.setSeriesItemLabelsVisible(0, true);
    //      renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator);
    plot.setDataset(0, this.dataset);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a"));
    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    chart.removeLegend();
    return chart;
}

From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsModeQuantilesChart.java

@Override
public JFreeChart createChart() {
    XYPlot plot = new XYPlot();
    ValueAxis xAxis = this.axisBuilder.createValueAxis("% of Population Sorted by Income");
    xAxis.setRange(0.0, 102.0);//from  ww w . ja  v  a  2  s  .  c om
    ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]");
    yAxis.setRange(-0.05, 0.3);
    plot.setDomainAxis(xAxis);
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, true);
    plot.setDataset(0, this.dataset);
    for (int i = 0; i <= 3; i++) {
        renderer2.setSeriesStroke(i, new BasicStroke(2.0f));
        renderer2.setSeriesOutlineStroke(i, new BasicStroke(3.0f));
        renderer2.setSeriesPaint(i, colorScheme.getColor(i + 1, "a"));
    }
    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    return chart;
}

From source file:playground.dgrether.analysis.charts.DgTravelTimeCalculatorChart.java

@Override
public JFreeChart createChart() {
    XYSeriesCollection dataset = this.createDataSet();
    XYPlot plot = new XYPlot();
    DgAxisBuilder axisBuilder = new DgDefaultAxisBuilder();
    ValueAxis xAxis = axisBuilder.createValueAxis("Simulation Time");
    //    xAxis.setRange(this.controllerConfig.getFirstIteration(), this.controllerConfig.getLastIteration() + 2);
    ValueAxis yAxis = axisBuilder.createValueAxis("Travel Time");
    //    yAxis.setRange(-0.05, 0.3);
    //    xAxis.setVisible(false);
    //    xAxis.setFixedAutoRange(1.0);
    plot.setDomainAxis(xAxis);/*from   w  w w  .  ja v a2  s .  c o  m*/
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, false);
    renderer2.setSeriesItemLabelsVisible(0, true);
    //    renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator);
    plot.setDataset(0, dataset);
    renderer2.setSeriesStroke(0, new BasicStroke(1.0f));
    renderer2.setSeriesOutlineStroke(0, new BasicStroke(1.0f));
    renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a"));
    renderer2.setSeriesStroke(1, new BasicStroke(1.0f));
    renderer2.setSeriesOutlineStroke(1, new BasicStroke(1.0f));
    renderer2.setSeriesPaint(1, colorScheme.getColor(2, "a"));
    renderer2.setSeriesStroke(2, new BasicStroke(1.0f));
    renderer2.setSeriesOutlineStroke(2, new BasicStroke(1.0f));
    renderer2.setSeriesPaint(2, colorScheme.getColor(3, "a"));
    renderer2.setSeriesStroke(3, new BasicStroke(1.0f));
    renderer2.setSeriesOutlineStroke(3, new BasicStroke(1.0f));
    renderer2.setSeriesPaint(3, colorScheme.getColor(4, "a"));

    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    //    chart.removeLegend();
    return chart;
}

From source file:playground.dgrether.signalsystems.analysis.DgGreenSplitPerIterationGraph.java

public JFreeChart createChart() {
    XYPlot plot = new XYPlot();
    ValueAxis xAxis = this.axisBuilder.createValueAxis("Iteration");
    xAxis.setRange(this.controllerConfig.getFirstIteration(), this.controllerConfig.getLastIteration() + 2);
    ValueAxis yAxis = this.axisBuilder.createValueAxis("GreenTime");
    //    yAxis.setRange(-0.05, 0.3);
    //    xAxis.setVisible(false);
    //    xAxis.setFixedAutoRange(1.0);
    plot.setDomainAxis(xAxis);// www .  j  av  a  2s .  co  m
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, true);
    renderer2.setSeriesItemLabelsVisible(0, true);
    //    renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator);
    plot.setDataset(0, this.getDataset());
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a"));
    renderer2.setSeriesStroke(1, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(1, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(1, colorScheme.getColor(2, "a"));
    renderer2.setSeriesStroke(2, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(2, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(2, colorScheme.getColor(3, "a"));
    renderer2.setSeriesStroke(3, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(3, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(3, colorScheme.getColor(4, "a"));

    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    //    chart.removeLegend();
    return chart;
}

From source file:playground.dgrether.analysis.charts.DgAvgDeltaMoneyGroupChart.java

public JFreeChart createChart() {
    XYPlot plot = new XYPlot();
    ValueAxis xAxis = this.axisBuilder.createValueAxis("Income [Chf / Year]");
    ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Money [Chf]");
    plot.setDomainAxis(xAxis);//  ww w . j a  v a2 s  .com
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, true);
    renderer2.setSeriesItemLabelsVisible(0, true);
    renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator);
    plot.setDataset(0, this.dataset);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a"));
    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    return chart;
}

From source file:org.sonar.server.charts.deprecated.BaseChart.java

protected void configureChart(JFreeChart chart, RectangleEdge legendPosition) {
    chart.setBackgroundPaint(new Color(255, 255, 255, 0));
    chart.setBackgroundImageAlpha(0.0f);
    chart.setBorderVisible(false);/* www.j av a  2s. com*/
    chart.setAntiAlias(true);
    chart.setTextAntiAlias(true);

    chart.removeLegend();
    if (legendPosition != null) {
        LegendTitle legend = new LegendTitle(chart.getPlot());
        legend.setPosition(legendPosition);
        legend.setItemPaint(BASE_COLOR);
        chart.addSubtitle(legend);
    }
}

From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsGroupChart.java

public JFreeChart createChart() {
    XYPlot plot = new XYPlot();
    ValueAxis xAxis = this.axisBuilder.createValueAxis("Income [Chf / Year]");
    ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]");
    plot.setDomainAxis(xAxis);/*from  www.  j a  v  a2s  . co  m*/
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, true);
    renderer2.setSeriesItemLabelsVisible(0, true);
    renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator);
    plot.setDataset(0, this.dataset);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a"));
    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    return chart;
}

From source file:org.sonar.api.charts.AbstractChart.java

private void improveChart(JFreeChart jfrechart, ChartParameters params) {
    Color background = Color
            .decode("#" + params.getValue(ChartParameters.PARAM_BACKGROUND_COLOR, "FFFFFF", false));
    jfrechart.setBackgroundPaint(background);

    jfrechart.setBorderVisible(false);/*  w w w  .j av  a  2s.c o  m*/
    jfrechart.setAntiAlias(true);
    jfrechart.setTextAntiAlias(true);
    jfrechart.removeLegend();
}

From source file:com.hmsinc.epicenter.webapp.chart.ChartService.java

/**
 * @param adapter//from   w w w .  j  a  v a  2s  .c o  m
 * @return
 */
public String getChartURL(final AbstractChart adapter, final List<XYAnnotation> annotations) {

    Validate.notNull(adapter, "No chart specified.");

    final String uuid = UUID.randomUUID().toString();

    final JFreeChart chart = createChart(adapter, annotations);
    chart.setAntiAlias(true);
    chart.setTextAntiAlias(true);

    configureRenderer(chart, adapter);
    configureTitleAndLegend(chart, adapter);

    chartCache.put(new Element(uuid, chart));
    return "chart?id=" + uuid;

}

From source file:org.deegree.graphics.charts.ChartsBuilder.java

/**
 * Creates a BufferedImage instance from a given chart, according to the given additional parameters
 *
 * @param chart/*from   w  ww  .j  a v  a 2 s . c o m*/
 * @param width
 *            of the generated image
 * @param height
 *            of the generated image
 * @param imageType
 *            ex image/png, image/jpg
 * @return BufferedImage
 */
protected BufferedImage createBufferedImage(JFreeChart chart, int width, int height, String imageType) {

    chart.setTextAntiAlias(true);
    chart.setAntiAlias(true);
    BufferedImage image = new BufferedImage(width, height, mapImageformat(imageType));
    Graphics2D g2 = image.createGraphics();
    chart.draw(g2, new Rectangle(new Dimension(width, height)));
    return image;
}