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

x33g5p2x  于2022-01-26 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(143)

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

Plot.setBackgroundPaint介绍

[英]Sets the background color of the plot area and sends a PlotChangeEvent to all registered listeners.
[中]设置打印区域的背景色,并向所有注册的侦听器发送PlotChangeEvent。

代码示例

代码示例来源: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: OpenNMS/opennms

private static void setPlotBackgroundColor(BarChart chartConfig,
    JFreeChart chart) {
  if (chartConfig.getPlotBackgroundColor().isPresent()) {
    final PlotBackgroundColor bgColor = chartConfig.getPlotBackgroundColor().get();
    final Optional<Rgb> rgb = bgColor.getRgb();
    if (rgb.isPresent()) {
      final Red red = rgb.get().getRed();
      final Blue blue = rgb.get().getBlue();
      final Green green = rgb.get().getGreen();
      
      chart.getPlot().setBackgroundPaint(new Color(red.getRgbColor(), green.getRgbColor(), blue.getRgbColor()));
    }
  }
}

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

private static void setPlotBackgroundColor(BarChart chartConfig,
    JFreeChart chart) {
  if (chartConfig.getPlotBackgroundColor().isPresent()) {
    final PlotBackgroundColor bgColor = chartConfig.getPlotBackgroundColor().get();
    final Optional<Rgb> rgb = bgColor.getRgb();
    if (rgb.isPresent()) {
      final Red red = rgb.get().getRed();
      final Blue blue = rgb.get().getBlue();
      final Green green = rgb.get().getGreen();
      
      chart.getPlot().setBackgroundPaint(new Color(red.getRgbColor(), green.getRgbColor(), blue.getRgbColor()));
    }
  }
}

代码示例来源:origin: no.uib/jsparklines

chartPanel.getChart().getPlot().setBackgroundPaint(new Color(bg.getRed(), bg.getGreen(), bg.getBlue()));
chartPanel.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue()));
chartPanel.getChart().setBackgroundPaint(new Color(bg.getRed(), bg.getGreen(), bg.getBlue()));

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

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/analysis-core-plugin

/**
 * Sets properties common to all plots of this plug-in.
 *
 * @param plot
 *            the plot to set the properties for
 */
// CHECKSTYLE:OFF
protected void setPlotProperties(final Plot plot) {
  plot.setBackgroundPaint(Color.WHITE);
  plot.setOutlinePaint(null);
  plot.setForegroundAlpha(0.8f);
  plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));
}
// CHECKSTYLE:ON

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Sets properties common to all plots of this plug-in.
 *
 * @param plot
 *            the plot to set the properties for
 */
// CHECKSTYLE:OFF
protected void setPlotProperties(final Plot plot) {
  plot.setBackgroundPaint(Color.WHITE);
  plot.setOutlinePaint(null);
  plot.setForegroundAlpha(0.8f);
  plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));
}
// CHECKSTYLE:ON

代码示例来源: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: activequant/aq2o

public static JFreeChart getStepChart(String title, TSContainer2 container) {

    TimeSeriesCollection tempDataSet = new TimeSeriesCollection();

    for (int i = 0; i < container.getNumColumns(); i++) {
      DoubleColumn dc = (DoubleColumn) container.getColumns().get(i);
      List<TimeStamp> ts = container.getTimeStamps();
      TimeSeries tsNew = new TimeSeries(container.getColumnHeaders().get(i));
      for (int j = 0; j < dc.size(); j++)
        tsNew.addOrUpdate(new Millisecond(ts.get(j).getDate()), dc.get(j));
      // add a new series.
      tempDataSet.addSeries(tsNew);

    }
    JFreeChart chart = ChartFactory.createXYStepChart(title, "Time", "Value", tempDataSet, PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.WHITE);
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    ((XYPlot)chart.getPlot()).setDomainGridlinePaint(Color.LIGHT_GRAY);
    ((XYPlot)chart.getPlot()).setRangeGridlinePaint(Color.LIGHT_GRAY);
    
    return chart;
  }
}

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

/**
 * Sets basic configuration including title font, subtitle, background paint and
 * anti-alias on the given JFreeChart.
 */
private void setBasicConfig( JFreeChart jFreeChart, BaseChart chart)
{
  jFreeChart.getTitle().setFont( TITLE_FONT );
  jFreeChart.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR );
  jFreeChart.setAntiAlias( true );
  if ( !chart.isHideTitle() )
  {
    jFreeChart.addSubtitle( getSubTitle( chart ) );
  }
  Plot plot = jFreeChart.getPlot();
  plot.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR );
  plot.setOutlinePaint( DEFAULT_BACKGROUND_COLOR );
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lab/dkpro-lab-core

/**
   * Exports a JFreeChart to a scalable PDF file.
   *
   * @param chart JFreeChart to export
   * @param aOS stream to write to.
   * @param aWidth width of the chart in pixels
   * @param aHeight height of the chart in pixels
   * @throws IOException if writing the svgFile fails.
   */
  public static void writeChartAsPDF(OutputStream aOS, JFreeChart chart, int aWidth, int aHeight)
    throws IOException
  {
    // Create an instance of the SVG Generator
    PDFDocumentGraphics2D pdfGenerator = new PDFDocumentGraphics2D(true, aOS, aWidth, aHeight);
    pdfGenerator.setDeviceDPI(PDFDocumentGraphics2D.NORMAL_PDF_RESOLUTION);
    pdfGenerator.setGraphicContext(new GraphicContext());
    pdfGenerator.setSVGDimension(aWidth, aHeight);
    pdfGenerator.setClip(0, 0, aWidth, aHeight);
    pdfGenerator.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);
    pdfGenerator.setRenderingHint(KEY_INTERPOLATION, VALUE_INTERPOLATION_BILINEAR);
    chart.setBackgroundPaint(Color.white);
    chart.getPlot().setBackgroundPaint(Color.white);
    // draw the chart in the SVG generator
    chart.draw(pdfGenerator, new Rectangle(aWidth, aHeight));
    pdfGenerator.finish();
  }
}

代码示例来源:origin: jasperreports/jasperreports

plot.setBackgroundPaint(TRANSPARENT_PAINT);
plot.setBackgroundPaint(getPlot().getBackcolor());

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public static void customizePlot(Plot plot, ChartParams params)
{
  if (params.get(ChartParams.PLOT_BACKGROUND_COLOR) != null) {
    plot.setBackgroundPaint(params.getColor(ChartParams.PLOT_BACKGROUND_COLOR));
  }
  if (params.get(ChartParams.PLOT_BACKGROUND_ALPHA) != null) {
    plot.setBackgroundAlpha(params.getFloat(ChartParams.PLOT_BACKGROUND_ALPHA).floatValue());
  }
  if (params.get(ChartParams.PLOT_FOREGROUND_ALPHA) != null) {
    plot.setForegroundAlpha(params.getFloat(ChartParams.PLOT_FOREGROUND_ALPHA).floatValue());
  }
  if (params.get(ChartParams.PLOT_INSERTS) != null) {
    plot.setInsets(params.getRectangleInsets(ChartParams.PLOT_INSERTS));
  }
  if (params.get(ChartParams.PLOT_OUTLINE_COLOR) != null) {
    plot.setOutlinePaint(params.getColor(ChartParams.PLOT_OUTLINE_COLOR));
  }
  if (params.get(ChartParams.PLOT_OUTLINE_STROKE) != null) {
    plot.setOutlineStroke(params.getStroke(ChartParams.PLOT_OUTLINE_STROKE));
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lab/de.tudarmstadt.ukp.dkpro.lab.core

/**
   * Exports a JFreeChart to a scalable PDF file.
   *
   * @param chart JFreeChart to export
   * @param aOS stream to write to.
   * @param aWidth width of the chart in pixels
   * @param aHeight height of the chart in pixels
   * @throws IOException if writing the svgFile fails.
   */
  public static void writeChartAsPDF(OutputStream aOS, JFreeChart chart, int aWidth, int aHeight)
    throws IOException
  {
    // Create an instance of the SVG Generator
    PDFDocumentGraphics2D pdfGenerator = new PDFDocumentGraphics2D(true, aOS, aWidth, aHeight);
    pdfGenerator.setDeviceDPI(PDFDocumentGraphics2D.NORMAL_PDF_RESOLUTION);
    pdfGenerator.setGraphicContext(new GraphicContext());
    pdfGenerator.setSVGDimension(aWidth, aHeight);
    pdfGenerator.setClip(0, 0, aWidth, aHeight);
    pdfGenerator.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);
    pdfGenerator.setRenderingHint(KEY_INTERPOLATION, VALUE_INTERPOLATION_BILINEAR);
    chart.setBackgroundPaint(Color.white);
    chart.getPlot().setBackgroundPaint(Color.white);
    // draw the chart in the SVG generator
    chart.draw(pdfGenerator, new Rectangle(aWidth, aHeight));
    pdfGenerator.finish();
  }
}

代码示例来源:origin: no.uib/jsparklines

chart.getPlot().setBackgroundPaint(backgroundColor);
  chart.setBackgroundPaint(backgroundColor);
} else {
  chart.getPlot().setBackgroundPaint(c.getBackground());
  chart.setBackgroundPaint(c.getBackground());

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

plot.setBackgroundPaint(this.plotBackgroundPaint);

代码示例来源:origin: jfree/jfreechart

plot.setBackgroundPaint(getBackgroundPaint());
plot.setInsets(getPlotInsets());

代码示例来源:origin: org.jboss.seam/jboss-seam-pdf

public void configurePlot(Plot plot) {
  if (getPlotBackgroundAlpha() != null) {
    plot.setBackgroundAlpha(getPlotBackgroundAlpha());
  }
  if (getPlotForegroundAlpha() != null) {
    plot.setForegroundAlpha(getPlotForegroundAlpha());
  }
  if (getPlotBackgroundPaint() != null) {
    plot.setBackgroundPaint(findColor(getPlotBackgroundPaint()));
  }
  if (getPlotOutlinePaint() != null) {
    plot.setOutlinePaint(findColor(getPlotOutlinePaint()));
  }
  if (getPlotOutlineStroke() != null) {
    plot.setOutlineStroke(findStroke(getPlotOutlineStroke()));
  }
}

代码示例来源:origin: jfree/jfreechart

plot.setBackgroundPaint(this.plotBackgroundPaint);

代码示例来源:origin: datacleaner/DataCleaner

plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST);
plot.setOutlineVisible(true);

相关文章