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

x33g5p2x  于2022-02-02 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(133)

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

XYPlot.setBackgroundPaint介绍

暂无

代码示例

代码示例来源:origin: graphhopper/jsprit

/**
 * Builds and returns JFreeChart.
 *
 * @return
 */
public JFreeChart build() {
  XYSeriesCollection collection = new XYSeriesCollection();
  for (XYSeries s : seriesMap.values()) {
    collection.addSeries(s);
  }
  JFreeChart chart = ChartFactory.createXYLineChart(chartName, xDomain, yDomain, collection, PlotOrientation.VERTICAL, true, true, false);
  XYPlot plot = chart.getXYPlot();
  plot.setBackgroundPaint(Color.WHITE);
  plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
  plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
  return chart;
}

代码示例来源:origin: org.cytoscape/network-analyzer-impl

/**
 * Updates the general properties of a plot.
 * 
 * @param aPlot
 *            Plot to be updated.
 * @param aGeneral
 *            General visual settings to be applied.
 */
private static void updateGeneral(XYPlot aPlot, GeneralVisSettings aGeneral) {
  aPlot.setBackgroundPaint(aGeneral.getBgColor());
}

代码示例来源:origin: graphhopper/jsprit

private XYPlot createPlot(final XYSeriesCollection problem, XYSeriesCollection shipments, XYSeriesCollection solution) {
  XYPlot plot = new XYPlot();
  plot.setBackgroundPaint(Color.LIGHT_GRAY);
  plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
  plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
  XYLineAndShapeRenderer problemRenderer = getProblemRenderer(problem);
  plot.setDataset(0, problem);
  plot.setRenderer(0, problemRenderer);
  XYItemRenderer shipmentsRenderer = getShipmentRenderer(shipments);
  plot.setDataset(1, shipments);
  plot.setRenderer(1, shipmentsRenderer);
  if (solution != null) {
    XYItemRenderer solutionRenderer = getRouteRenderer(solution);
    plot.setDataset(2, solution);
    plot.setRenderer(2, solutionRenderer);
  }
  NumberAxis xAxis = new NumberAxis();
  NumberAxis yAxis = new NumberAxis();
  if (boundingBox == null) {
    xAxis.setRangeWithMargins(getDomainRange(problem));
    yAxis.setRangeWithMargins(getRange(problem));
  } else {
    xAxis.setRangeWithMargins(new Range(boundingBox.minX, boundingBox.maxX));
    yAxis.setRangeWithMargins(new Range(boundingBox.minY, boundingBox.maxY));
  }
  plot.setDomainAxis(xAxis);
  plot.setRangeAxis(yAxis);
  return plot;
}

代码示例来源:origin: micromata/projectforge

public XYChartBuilder(final JFreeChart chart)
{
 this.chart = chart;
 plot = chart.getXYPlot();
 plot.setBackgroundPaint(Color.white);
 plot.setDomainGridlinePaint(Color.lightGray);
 plot.setRangeGridlinePaint(Color.lightGray);
 plot.setOutlineVisible(false);
}

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

private JFreeChart createChart() {
  final XYDataset dataset = this.createDataset(series);
  final JFreeChart result = ChartFactory.createTimeSeriesChart("Dynamic Line And TimeSeries Chart", "Time", "Value", dataset, true, true, false);

  final XYPlot plot = result.getXYPlot();
  plot.setBackgroundPaint(new Color(0xffffe0));
  plot.setDomainGridlinesVisible(true);
  plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
  plot.setRangeGridlinesVisible(true);
  plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

  // first time series
  this.firstTimeSeries(plot);

  // second time series
  this.secondTimeSeries(plot);

  // third time series
  this.thirdTimeSeries(plot);

  return result;
}

代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark

public OperationsVersusSizePlot( String title, String ylabel)
  {
    chart = ChartFactory.createXYLineChart(title,
        "Matrix Size",
        ylabel,
        null,
        PlotOrientation.VERTICAL,
        true , false , false  );

//        chart.removeLegend();
    plot = (XYPlot) chart.getPlot();

    plot.setBackgroundPaint(Color.WHITE);

//        final NumberAxis rangeAxis = new LogarithmicAxis(ylabel);
//        plot.setRangeAxis(rangeAxis);

    // one of the numbers is getting cropped.  this will make it fully visible
    chart.setPadding(new RectangleInsets(5,0,0,5));

  }

代码示例来源:origin: com.graphhopper/jsprit-analysis

/**
 * Builds and returns JFreeChart.
 *
 * @return
 */
public JFreeChart build() {
  XYSeriesCollection collection = new XYSeriesCollection();
  for (XYSeries s : seriesMap.values()) {
    collection.addSeries(s);
  }
  JFreeChart chart = ChartFactory.createXYLineChart(chartName, xDomain, yDomain, collection, PlotOrientation.VERTICAL, true, true, false);
  XYPlot plot = chart.getXYPlot();
  plot.setBackgroundPaint(Color.WHITE);
  plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
  plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
  return chart;
}

代码示例来源:origin: org.gephi/statistics-plugin

public static void decorateChart(JFreeChart chart) {
  XYPlot plot = (XYPlot) chart.getPlot();
  XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
  renderer.setSeriesLinesVisible(0, false);
  renderer.setSeriesShapesVisible(0, true);
  renderer.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(0, 0, 2, 2));
  plot.setBackgroundPaint(java.awt.Color.WHITE);
  plot.setDomainGridlinePaint(java.awt.Color.GRAY);
  plot.setRangeGridlinePaint(java.awt.Color.GRAY);
  plot.setRenderer(renderer);
}

代码示例来源:origin: org.kurento/kurento-test

public void drawChart(String filename, int width, int height) throws IOException {
 // Create plot
 NumberAxis xAxis = new NumberAxis(xAxisLabel);
 NumberAxis yAxis = new NumberAxis(yAxisLabel);
 XYSplineRenderer renderer = new XYSplineRenderer();
 XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
 plot.setBackgroundPaint(Color.lightGray);
 plot.setDomainGridlinePaint(Color.white);
 plot.setRangeGridlinePaint(Color.white);
 plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
 // Create chart
 JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
 ChartUtilities.applyCurrentTheme(chart);
 ChartPanel chartPanel = new ChartPanel(chart, false);
 // Draw png
 BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
 Graphics graphics = bi.getGraphics();
 chartPanel.setBounds(0, 0, width, height);
 chartPanel.paint(graphics);
 ImageIO.write(bi, "png", new File(filename));
}

代码示例来源:origin: Kurento/kurento-java

public void drawChart(String filename, int width, int height) throws IOException {
 // Create plot
 NumberAxis xAxis = new NumberAxis(xAxisLabel);
 NumberAxis yAxis = new NumberAxis(yAxisLabel);
 XYSplineRenderer renderer = new XYSplineRenderer();
 XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
 plot.setBackgroundPaint(Color.lightGray);
 plot.setDomainGridlinePaint(Color.white);
 plot.setRangeGridlinePaint(Color.white);
 plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
 // Create chart
 JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
 ChartUtilities.applyCurrentTheme(chart);
 ChartPanel chartPanel = new ChartPanel(chart, false);
 // Draw png
 BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
 Graphics graphics = bi.getGraphics();
 chartPanel.setBounds(0, 0, width, height);
 chartPanel.paint(graphics);
 ImageIO.write(bi, "png", new File(filename));
}

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

public static void setupPlot(XYPlot plot)
{
  plot.setBackgroundPaint(ChartDefaults.transparent);
  plot.setOutlinePaint(ChartDefaults.transparent);
  plot.setRangeGridlinePaint(ChartDefaults.gridLineColor);
  plot.setRangeGridlineStroke(new BasicStroke(0.5f));
  plot.setRangeGridlinesVisible(true);
  plot.setRangeAxisLocation(ChartDefaults.rangeAxisLocation);
  plot.setDomainGridlinesVisible(true);
  ChartUtil.setupRangeAxis(plot.getRangeAxis());
  ChartUtil.setupDomainAxis(plot.getDomainAxis());
}

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

public static void setupPlot(XYPlot plot)
{
  plot.setBackgroundPaint(ChartDefaults.transparent);
  plot.setOutlinePaint(ChartDefaults.transparent);
  plot.setRangeGridlinePaint(ChartDefaults.gridLineColor);
  plot.setRangeGridlineStroke(new BasicStroke(0.5f));
  plot.setRangeGridlinesVisible(true);
  plot.setRangeAxisLocation(ChartDefaults.rangeAxisLocation);
  plot.setDomainGridlinesVisible(true);
  ChartUtil.setupRangeAxis(plot.getRangeAxis());
  ChartUtil.setupDomainAxis(plot.getDomainAxis());
}

代码示例来源:origin: bcdev/beam

private void initPlot() {
  final ValueAxis domainAxis = timeSeriesPlot.getDomainAxis();
  domainAxis.setAutoRange(true);
  XYLineAndShapeRenderer xyRenderer = new XYLineAndShapeRenderer(true, true);
  xyRenderer.setBaseLegendTextPaint(DEFAULT_FOREGROUND_COLOR);
  timeSeriesPlot.setRenderer(xyRenderer);
  timeSeriesPlot.setBackgroundPaint(DEFAULT_BACKGROUND_COLOR);
  timeSeriesPlot.setNoDataMessage(NO_DATA_MESSAGE);
  timeSeriesPlot.setDrawingSupplier(null);
}

代码示例来源:origin: senbox-org/snap-desktop

private static TimeSeriesCollection addSubPlot(CombinedDomainXYPlot plot, String label) {
  final TimeSeriesCollection seriesCollection = new TimeSeriesCollection(new TimeSeries(label, Millisecond.class));
  NumberAxis rangeAxis = new NumberAxis();
  rangeAxis.setAutoRangeIncludesZero(false);
  XYPlot subplot = new XYPlot(seriesCollection, null, rangeAxis, new StandardXYItemRenderer());
  subplot.setBackgroundPaint(Color.lightGray);
  subplot.setDomainGridlinePaint(Color.white);
  subplot.setRangeGridlinePaint(Color.white);
  plot.add(subplot);
  return seriesCollection;
}

代码示例来源:origin: bcdev/beam

private static TimeSeriesCollection addSubPlot(CombinedDomainXYPlot plot, String label) {
  final TimeSeriesCollection seriesCollection = new TimeSeriesCollection(new TimeSeries(label, Millisecond.class));
  NumberAxis rangeAxis = new NumberAxis();
  rangeAxis.setAutoRangeIncludesZero(false);
  XYPlot subplot = new XYPlot(seriesCollection, null, rangeAxis, new StandardXYItemRenderer());
  subplot.setBackgroundPaint(Color.lightGray);
  subplot.setDomainGridlinePaint(Color.white);
  subplot.setRangeGridlinePaint(Color.white);
  plot.add(subplot);
  return seriesCollection;
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

/**
 * Creates a chart.
 * 
 * @param dataset
 *            a dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(SimpleHistogramDataset dataset) {
  chart = ChartFactory.createHistogram(null, engl("Value"), engl("Histogram"), dataset, PlotOrientation.VERTICAL, false, true, false);
  chart.setBackgroundPaint(Color.white);
  XYPlot plot = (XYPlot) chart.getPlot();
  plot.setBackgroundPaint(Color.white);
  plot.getRenderer().setSeriesPaint(0, new Color(0x7f9f51));
  plot.setDomainGridlinePaint(Color.lightGray);
  plot.setRangeGridlinePaint(Color.lightGray);
  plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
  plot.setDomainCrosshairVisible(false);
  plot.setRangeCrosshairVisible(false);
  return chart;
}

代码示例来源:origin: org.n52.sensorweb/timeseries-io

private XYPlot createPlotArea(JFreeChart chart) {
  XYPlot plot = chart.getXYPlot();
  plot.setBackgroundPaint(WHITE);
  plot.setDomainGridlinePaint(LIGHT_GRAY);
  plot.setRangeGridlinePaint(LIGHT_GRAY);
  plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
  showCrosshairsOnAxes(plot);
  configureDomainAxis(plot);
  showGridlinesOnChart(plot);
  configureTimeAxis(plot);
  configureTitle(chart);
  addNotice(chart);
  return plot;
}

代码示例来源:origin: org.n52.series-api/io

private XYPlot createPlotArea(JFreeChart chart) {
  XYPlot plot = chart.getXYPlot();
  plot.setBackgroundPaint(Color.WHITE);
  plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
  plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
  plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
  showCrosshairsOnAxes(plot);
  configureDomainAxis(plot);
  showGridlinesOnChart(plot);
  configureTimeAxis(plot);
  configureTitle(chart);
  addNotice(chart);
  return plot;
}

代码示例来源:origin: net.imglib2/imglib2-script

static private final void setBackgroundDefault(final JFreeChart chart) {
    BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[]{2.0f, 1.0f}, 0.0f);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlineStroke(gridStroke);
    plot.setDomainGridlineStroke(gridStroke);
    plot.setBackgroundPaint(new Color(235, 235, 235));
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setOutlineVisible(false);
    plot.getDomainAxis().setAxisLineVisible(false);
    plot.getRangeAxis().setAxisLineVisible(false);
    plot.getDomainAxis().setLabelPaint(Color.gray);
    plot.getRangeAxis().setLabelPaint(Color.gray);
    plot.getDomainAxis().setTickLabelPaint(Color.gray);
    plot.getRangeAxis().setTickLabelPaint(Color.gray);
    chart.getTitle().setPaint(Color.gray);
  }
}

代码示例来源:origin: net.imagej/imagej-ui-swing

private final void setBackgroundDefault(final JFreeChart chart) {
  final BasicStroke gridStroke =
    new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
      1.0f, new float[] { 2.0f, 1.0f }, 0.0f);
  final XYPlot plot = (XYPlot) chart.getPlot();
  plot.setRangeGridlineStroke(gridStroke);
  plot.setDomainGridlineStroke(gridStroke);
  plot.setBackgroundPaint(new Color(235, 235, 235));
  plot.setRangeGridlinePaint(Color.white);
  plot.setDomainGridlinePaint(Color.white);
  plot.setOutlineVisible(false);
  plot.getDomainAxis().setAxisLineVisible(false);
  plot.getRangeAxis().setAxisLineVisible(false);
  plot.getDomainAxis().setLabelPaint(Color.gray);
  plot.getRangeAxis().setLabelPaint(Color.gray);
  plot.getDomainAxis().setTickLabelPaint(Color.gray);
  plot.getRangeAxis().setTickLabelPaint(Color.gray);
  final TextTitle title = chart.getTitle();
  if (title != null) title.setPaint(Color.black);
}

相关文章

微信公众号

最新文章

更多

XYPlot类方法