org.jfree.chart.JFreeChart.setBackgroundPaint()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.jfree.chart.JFreeChart.setBackgroundPaint()方法的一些代码示例,展示了JFreeChart.setBackgroundPaint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFreeChart.setBackgroundPaint()方法的具体详情如下:
包路径:org.jfree.chart.JFreeChart
类名称:JFreeChart
方法名:setBackgroundPaint

JFreeChart.setBackgroundPaint介绍

[英]Sets the paint used to fill the chart background and sends a ChartChangeEvent to all registered listeners.
[中]设置用于填充图表背景的绘制,并向所有注册的侦听器发送ChartChangeEvent。

代码示例

代码示例来源:origin: jenkinsci/jenkins

private BufferedImage render(StaplerRequest req, ChartRenderingInfo info) {
  String w = req.getParameter("width");
  if(w==null)     w=String.valueOf(defaultW);
  String h = req.getParameter("height");
  if(h==null)     h=String.valueOf(defaultH);
  Color graphBg = stringToColor(req.getParameter("graphBg"));
  Color plotBg = stringToColor(req.getParameter("plotBg"));
  if (graph==null)    graph = createGraph();
  graph.setBackgroundPaint(graphBg);
  Plot p = graph.getPlot();
  p.setBackgroundPaint(plotBg);
  return graph.createBufferedImage(Integer.parseInt(w),Integer.parseInt(h),info);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Draws a chart into {@link JFreeChart}.
 */
public JFreeChart createChart() {
  final JFreeChart chart = ChartFactory.createLineChart(null, // chart title
      null, // unused
      null, // range axis label
      dataset, // data
      PlotOrientation.VERTICAL, // orientation
      true, // include legend
      true, // tooltips
      false // urls
      );
  chart.setBackgroundPaint(Color.white);
  chart.getLegend().setItemFont(CHART_FONT);
  final CategoryPlot plot = chart.getCategoryPlot();
  configurePlot(plot);
  configureRangeAxis((NumberAxis) plot.getRangeAxis());
  crop(plot);
  return chart;
}

代码示例来源:origin: pentaho/pentaho-kettle

true, // tooltips
  false ); // urls       
chart.setBackgroundPaint( Color.white );
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint( Color.white );

代码示例来源:origin: pentaho/pentaho-kettle

true, // tooltips
  false ); // urls       
chart.setBackgroundPaint( Color.white );
TextTitle title = new TextTitle( chartTitle );

代码示例来源:origin: jenkinsci/jenkins

);
chart.setBackgroundPaint(Color.white);

代码示例来源:origin: stackoverflow.com

XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries);
 StandardXYToolTipGenerator ttg = new StandardXYToolTipGenerator(
     "{0}: {2}", chartFormatter, NumberFormat.getInstance());
 StandardXYItemRenderer renderer = new StandardXYItemRenderer(
     StandardXYItemRenderer.SHAPES_AND_LINES, ttg, null);
 renderer.setShapesFilled(true);
 XYPlot plot = new XYPlot(xyDataset, dateAxis, valueAxis, renderer);
 JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, false);
 chart.setBackgroundPaint(java.awt.Color.WHITE);

代码示例来源:origin: jenkinsci/jenkins

);
chart.setBackgroundPaint(Color.white);

代码示例来源:origin: stackoverflow.com

chart.setBackgroundPaint(Color.YELLOW);
MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot();
plot.setBackgroundPaint(Color.BLUE);
JFreeChart subchart = plot.getPieChart();
subchart.setBackgroundPaint(Color.RED);

代码示例来源:origin: psi-probe/psi-probe

chart.setBackgroundPaint(new Color(backgroundColor));
for (int i = 0; i < seriesMaxCount; i++) {
 if (seriesColor[i] >= 0) {

代码示例来源:origin: matsim-org/matsim

/**
 * Adds default formatting options for the charts, like a white background etc.
 * Requires the member {@link #chart} to be set by the overriding class!
 */
protected void addDefaultFormatting() {
  this.chart.setBackgroundPaint(new Color(1.0f, 1.0f, 1.0f, 1.0f));
  this.chart.getLegend().setBorder(0.0, 0.0, 0.0, 0.0);
}

代码示例来源:origin: dhis2/dhis2-core

/**
 * Returns a basic JFreeChart.
 */
private JFreeChart getBasicJFreeChart( CategoryPlot plot )
{
  JFreeChart jFreeChart = new JFreeChart( null, TITLE_FONT, plot, false );
  jFreeChart.setBackgroundPaint( Color.WHITE );
  jFreeChart.setAntiAlias( true );
  return jFreeChart;
}

代码示例来源:origin: MegaMek/mekhq

private JFreeChart createMonthlyChart(CategoryDataset dataset) {
  JFreeChart chart = ChartFactory.createBarChart(
    "", // title
    resourceMap.getString("graphDate.text"), // x-axis label
    resourceMap.getString("graphCBills.text"), // y-axis label
    dataset);
  chart.setBackgroundPaint(Color.WHITE);
  
  chart.getLegend().setPosition(RectangleEdge.TOP);
  return chart;
}

代码示例来源:origin: org.codehaus.sonar/sonar-deprecated

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);
 jfrechart.setAntiAlias(true);
 jfrechart.setTextAntiAlias(true);
 jfrechart.removeLegend();
}

代码示例来源:origin: OpenNMS/opennms

private static void setChartBackgroundColor(BarChart chartConfig,
    JFreeChart chart) {
  if (chartConfig.getChartBackgroundColor().isPresent()) {
    final ChartBackgroundColor bgColor = chartConfig.getChartBackgroundColor().get();
    Red red = bgColor.getRgb().getRed();
    Blue blue = bgColor.getRgb().getBlue();
    Green green = bgColor.getRgb().getGreen();
    chart.setBackgroundPaint(new Color(red.getRgbColor(), green.getRgbColor(), blue.getRgbColor()));
  }
}

代码示例来源:origin: org.opennms/opennms-web-api

private static void setChartBackgroundColor(BarChart chartConfig,
    JFreeChart chart) {
  if (chartConfig.getChartBackgroundColor().isPresent()) {
    final ChartBackgroundColor bgColor = chartConfig.getChartBackgroundColor().get();
    Red red = bgColor.getRgb().getRed();
    Blue blue = bgColor.getRgb().getBlue();
    Green green = bgColor.getRgb().getGreen();
    chart.setBackgroundPaint(new Color(red.getRgbColor(), green.getRgbColor(), blue.getRgbColor()));
  }
}

代码示例来源:origin: org.openfuxml/ofx-chart

protected void setColors()
{
  chart.setBackgroundPaint(ChartColorFactory.createColor(ofxChart, ChartColorFactory.Area.backgroundChart));
  chart.getPlot().setBackgroundPaint(ChartColorFactory.createColor(ofxChart, ChartColorFactory.Area.backgroundPlot));
  setSpecialColors();
}
protected void setSpecialColors(){logger.error("This should be @Overridden");}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Updates the properties of a chart to match the properties defined on the
 * panel.
 *
 * @param chart  the chart.
 */
public void updateChart(JFreeChart chart) {
  this.titleEditor.setTitleProperties(chart);
  this.plotEditor.updatePlotProperties(chart.getPlot());
  chart.setAntiAlias(getAntiAlias());
  chart.setBackgroundPaint(getBackgroundPaint());
}

代码示例来源:origin: org.jvnet.its/issuetracker-stats

protected JFreeChart createChart(XYDataset dataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(
      null, "time", "# of issues", dataset, true, false, false);
    jfreechart.setBackgroundPaint(Color.WHITE);

    XYPlot plot = (XYPlot)jfreechart.getPlot();
    XYStepAreaRenderer renderer = new XYStepAreaRenderer();
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0,ColorPalette.RED);
    renderer.setSeriesPaint(1,ColorPalette.GREEN);

    return jfreechart;
  }
}

代码示例来源:origin: com.atlassian.confluence.extra.chart/chart-plugin

public static void setDefaults(JFreeChart chart)
{
  chart.setBackgroundPaint(ChartDefaults.transparent);
  chart.setBorderVisible(false);
  chart.getPlot().setNoDataMessage("No Data Available");
  setupPlot(chart.getPlot());
  ChartUtil.setupTextTitle(chart.getTitle());
  ChartUtil.setupLegendTitle(chart.getLegend());
}

代码示例来源:origin: com.atlassian.jira/jira-api

public static void setDefaults(JFreeChart chart, final I18nHelper i18nHelper)
{
  chart.setBackgroundPaint(Color.WHITE);
  chart.setBorderVisible(false);
  chart.getPlot().setNoDataMessage(i18nHelper.getText("gadget.charts.no.data"));
  setupPlot(chart.getPlot());
  ChartUtil.setupTextTitle(chart.getTitle());
  ChartUtil.setupLegendTitle(chart.getLegend());
}

相关文章