Example usage for org.jfree.chart JFreeChart setBackgroundPaint

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

Introduction

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

Prototype

public void setBackgroundPaint(Paint paint) 

Source Link

Document

Sets the paint used to fill the chart background and sends a ChartChangeEvent to all registered listeners.

Usage

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

public JDBCCategoryChartDemo(String s) {
    super(s);//  ww w  . j  a v a  2 s  .  com
    CategoryDataset categorydataset = readData();
    JFreeChart jfreechart = ChartFactory.createBarChart3D("JDBC Category Chart Demo", "Category", "Value",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.yellow);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    setContentPane(chartpanel);
}

From source file:sanger.team16.gui.genevar.eqtl.snp.RegionalLinePlot.java

public ChartPanel getChartPanel(String chromosome, int position, int distance, double threshold)
        throws ArrayIndexOutOfBoundsException {
    JFreeChart chart = createChart(chromosome, position, distance, threshold, dataset);
    chart.setBackgroundPaint(Color.white);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(680, 210));

    return chartPanel;
}

From source file:compecon.dashboard.panel.AbstractChartsPanel.java

protected void configureChart(JFreeChart chart) {
    chart.setBackgroundPaint(Color.white);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    DateAxis dateAxis = (DateAxis) plot.getDomainAxis();
    NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis();

    dateAxis.setDateFormatOverride(new SimpleDateFormat("dd-MMM"));
    valueAxis.setAutoRangeIncludesZero(true);
    valueAxis.setUpperMargin(0.15);/*from w  ww .  j a  va 2  s  .  co  m*/
    valueAxis.setLowerMargin(0.15);
}

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  2 s.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.DgModalSplitQuantilesChart.java

public JFreeChart createChart() {
    CategoryAxis categoryAxis = this.axisBuilder.createCategoryAxis(xLabel);
    categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
    ValueAxis valueAxis = this.axisBuilder.createValueAxis(yLabel);
    valueAxis.setRange(0.0, 102.0);/* w ww . ja va2 s  . c  o m*/

    DgColorScheme colorScheme = new DgColorScheme();

    CategoryPlot plot = new CategoryPlot();
    plot.setDomainAxis(categoryAxis);
    plot.setRangeAxis(valueAxis);
    plot.setDataset(0, this.dataset);
    BarRenderer carRenderer = new BarRenderer();
    carRenderer.setSeriesPaint(0, colorScheme.COLOR1A);
    carRenderer.setSeriesPaint(1, colorScheme.COLOR3A);

    carRenderer.setItemMargin(0.10);
    plot.setRenderer(0, carRenderer);

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

From source file:userInterface.MonitoringTeamRole.DashBoarJPanel.java

private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
    // TODO add your handling code here:

    JFreeChart chart = createChart(createDataset());
    chart.setBackgroundPaint(Color.YELLOW);
    chart.getTitle().setPaint(Color.red);

    ChartFrame frame = new ChartFrame("XYChart", chart);
    frame.setVisible(true);/*from  w  w w. ja v a  2  s  .  co  m*/
    frame.setSize(450, 500);
}

From source file:org.openmrs.module.usagestatistics.web.view.chart.AbstractChartView.java

/**
 * @see org.springframework.web.servlet.view.AbstractView
 */// www  .  j a  v a2s . co m
@Override
@SuppressWarnings("unchecked")
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    // Respond as a PNG image
    response.setContentType("image/png");

    // Disable caching
    response.setHeader("Pragma", "No-cache");
    response.setDateHeader("Expires", 0);
    response.setHeader("Cache-Control", "no-cache");

    int width = ServletRequestUtils.getIntParameter(request, "width", 500);
    int height = ServletRequestUtils.getIntParameter(request, "height", 300);

    from = (Date) model.get("from");
    until = (Date) model.get("until");
    untilInclusive = (Date) model.get("untilInclusive");
    usageFilter = (ActionCriteria) model.get("usageFilter");
    location = (Location) model.get("location");

    JFreeChart chart = createChart(model, request);
    chart.setBackgroundPaint(Color.WHITE);
    chart.getPlot().setOutlineStroke(new BasicStroke(0));
    chart.getPlot().setOutlinePaint(getBackgroundColor());
    chart.getPlot().setBackgroundPaint(getBackgroundColor());

    ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, width, height);
}

From source file:org.lsug.quota.portlet.UserQuotaPortlet.java

protected JFreeChart getCurrentSizeJFreeChart(String title, PieDataset pieDataset) {
    JFreeChart jFreeChart = ChartFactory.createPieChart3D(title, pieDataset, true, false, null);
    jFreeChart.setBackgroundPaint(Color.white);

    return jFreeChart;
}

From source file:org.openmrs.module.usagestatistics668.web.view.chart.AbstractChartView.java

/**
 * @see org.springframework.web.servlet.view.AbstractView
 *//*from   w w w.j a v a2  s.  co  m*/
@Override
@SuppressWarnings("unchecked")
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    // Respond as a PNG image
    response.setContentType("image/png");

    // Disable caching
    response.setHeader("Pragma", "No-cache");
    response.setDateHeader("Expires", 0);
    response.setHeader("Cache-Control", "no-cache");

    int width = ServletRequestUtils.getIntParameter(request, "width", 500);
    int height = ServletRequestUtils.getIntParameter(request, "height", 300);

    from = (Date) model.get("from");
    System.out.println(from);
    maxResults = (Integer) model.get("maxResults");
    until = (Date) model.get("until");
    untilInclusive = (Date) model.get("untilInclusive");
    usageFilter = (ActionCriteria) model.get("usageFilter");

    JFreeChart chart = createChart(model, request);
    chart.setBackgroundPaint(Color.WHITE);
    chart.getPlot().setOutlineStroke(new BasicStroke(0));
    chart.getPlot().setOutlinePaint(getBackgroundColor());
    chart.getPlot().setBackgroundPaint(getBackgroundColor());

    ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, width, height);
}

From source file:userInterface.MonitoringTeamRole.DashBoarJPanel.java

private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked
    // TODO add your handling code here:

    JFreeChart chart1 = createChart1(createDataset1());
    chart1.setBackgroundPaint(Color.YELLOW);
    chart1.getTitle().setPaint(Color.red);

    ChartFrame frame = new ChartFrame("XYChart", chart1);
    frame.setVisible(true);/*from w ww .ja  v  a2s  .c  o  m*/
    frame.setSize(450, 500);
}