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

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

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

XYPlot.setDomainGridlinesVisible介绍

[英]Sets the flag that controls whether or not the domain grid-lines are visible.

If the flag value is changed, a PlotChangeEvent is sent to all registered listeners.
[中]设置控制域网格线是否可见的标志。
如果标志值已更改,则会向所有注册的侦听器发送PlotChangeEvent。

代码示例

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

List<XYPlot> subplots = (List<XYPlot>) combinedPlots.getSubplots();
for (XYPlot p:subplots) p.setDomainGridlinesVisible(false);

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

private void showGridlinesOnChart(XYPlot xyPlot) {
  boolean grid = getChartStyleDefinitions().isGrid();
  xyPlot.setDomainGridlinesVisible(grid);
  xyPlot.setRangeGridlinesVisible(grid);
}

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

private void showGridlinesOnChart(XYPlot plot) {
  IoParameters parameters = getParameters();
  boolean showGrid = parameters.isGrid();
  plot.setDomainGridlinesVisible(showGrid);
  plot.setRangeGridlinesVisible(showGrid);
}

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

private void setGridVisible(boolean visible) {
  chart.getXYPlot().setDomainGridlinesVisible(visible);
  chart.getXYPlot().setRangeGridlinesVisible(visible);
}

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

private void setGridVisible(boolean visible) {
  chart.getXYPlot().setDomainGridlinesVisible(visible);
  chart.getXYPlot().setRangeGridlinesVisible(visible);
}

代码示例来源: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: 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: org.openfuxml/ofx-chart

@Override
protected void setSpecialGrid()
{
  XYPlot plot = (XYPlot) chart.getPlot();
  Grid grid = ofxChart.getGrid();
  if(grid.isSetDomain()){plot.setDomainGridlinesVisible(grid.isDomain());}
  if(grid.isSetRange()){plot.setRangeGridlinesVisible(grid.isRange());}
}

代码示例来源:origin: us.ihmc/simulation-construction-set-tools

public void enableGrid(boolean enable)
{
 if (enable)
 {
   BasicStroke dotted = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {1.0f, 6.0f}, 0.0f);
   graph.getXYPlot().setDomainGridlinesVisible(true);
   graph.getXYPlot().setRangeGridlinesVisible(true);
   graph.getXYPlot().setRangeGridlinePaint(Color.black);
   graph.getXYPlot().setDomainGridlinePaint(Color.black);
   graph.getXYPlot().setRangeGridlineStroke(dotted);
   graph.getXYPlot().setDomainGridlineStroke(dotted);
 }
 else
 {
   graph.getXYPlot().setDomainGridlinesVisible(false);
   graph.getXYPlot().setRangeGridlinesVisible(false);
 }
}

代码示例来源:origin: cpesch/RouteConverter

private XYPlot createPlot(JFreeChart chart) {
  XYPlot plot = chart.getXYPlot();
  plot.setForegroundAlpha(0.65F);
  plot.setDomainGridlinesVisible(preferences.getBoolean(X_GRID_PREFERENCE, true));
  plot.setRangeGridlinesVisible(preferences.getBoolean(Y_GRID_PREFERENCE, true));
  NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
  rangeAxis.setAutoRangeIncludesZero(false);
  rangeAxis.setStandardTickUnits(createIntegerTickUnits());
  Font font = new JLabel().getFont();
  rangeAxis.setLabelFont(font);
  NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
  domainAxis.setStandardTickUnits(createIntegerTickUnits());
  domainAxis.setLowerMargin(0.0);
  domainAxis.setUpperMargin(0.0);
  domainAxis.setLabelFont(font);
  plot.getRenderer().setBaseToolTipGenerator(null);
  return plot;
}

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

/**
 * Utility method to set the default style of the XY Step Area Charts
 *
 * @param chart {@link JFreeChart} to style
 */
private static void setXYStepAreaChartDefaults(JFreeChart chart)
{
  ChartUtil.setDefaults(chart);
  XYPlot plot = (XYPlot) chart.getPlot();
  plot.setDomainGridlinesVisible(false);
  // renderer
  XYStepAreaRenderer renderer = (XYStepAreaRenderer) plot.getRenderer();
  renderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
  renderer.setBaseItemLabelPaint(ChartDefaults.axisLabelColor);
  renderer.setShapesVisible(false);
  renderer.setBaseStroke(ChartDefaults.defaultStroke);
  for (int j = 0; j < ChartDefaults.darkColors.length; j++)
  {
    renderer.setSeriesStroke(j, ChartDefaults.defaultStroke);
    renderer.setSeriesPaint(j, ChartDefaults.darkColors[j]);
  }
  StandardXYToolTipGenerator generator =
    new StandardXYToolTipGenerator("{1}, {2}", NumberFormat.getInstance(), NumberFormat.getInstance());
  renderer.setBaseToolTipGenerator(generator);
}

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

public static JFreeChart chartProfile(DefaultTableXYDataset dataset, ChartType type) {
  JFreeChart chart;
  switch (type) {
    case Line:
      chart = ChartFactory
          .createXYLineChart("TimeProfile", "Time [h]", "Values", dataset, PlotOrientation.VERTICAL, true,
              false, false);
      break;
    case StackedArea:
      chart = ChartFactory.createStackedXYAreaChart("TimeProfile", "Time [h]", "Values", dataset,
          PlotOrientation.VERTICAL, true, false, false);
      break;
    default:
      throw new IllegalArgumentException();
  }
  XYPlot plot = chart.getXYPlot();
  plot.setRangeGridlinesVisible(false);
  plot.setDomainGridlinesVisible(false);
  plot.setBackgroundPaint(Color.white);
  NumberAxis xAxis = (NumberAxis)plot.getDomainAxis();
  xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  NumberAxis yAxis = (NumberAxis)plot.getRangeAxis();
  yAxis.setAutoRange(true);
  XYItemRenderer renderer = plot.getRenderer();
  for (int s = 0; s < dataset.getSeriesCount(); s++) {
    renderer.setSeriesStroke(s, new BasicStroke(2));
  }
  return chart;
}

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

/**
 * Utility method to set the default style of the XY Step Charts
 *
 * @param chart {@link JFreeChart} to style
 */
private static void setXYStepChartDefaults(JFreeChart chart)
{
  ChartUtil.setDefaults(chart);
  XYPlot plot = (XYPlot) chart.getPlot();
  plot.setDomainGridlinesVisible(false);
  // renderer
  XYStepRenderer renderer = (XYStepRenderer) plot.getRenderer();
  renderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
  renderer.setBaseStroke(ChartDefaults.defaultStroke);
  renderer.setShapesVisible(false);
  for (int j = 0; j < ChartDefaults.darkColors.length; j++)
  {
    renderer.setSeriesStroke(j, ChartDefaults.defaultStroke);
    renderer.setSeriesPaint(j, ChartDefaults.darkColors[j]);
  }
}

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

/**
 * Updates the axis-related properties of a plot.
 * 
 * @param aPlot
 *            Plot to be updated.
 * @param aAxes
 *            Axis-related visual settings to be applied.
 * @param aGrid
 *            Grid-related visual settings to be applied.
 */
private static void updateAxes(XYPlot aPlot, AxesSettings aAxes, GridSettings aGrid,
    Range aDomainDataRange, Range aRangeDataRange) {
  aPlot.setDomainAxis(createAxis(aAxes, true, aDomainDataRange));
  aPlot.setRangeAxis(createAxis(aAxes, false, aRangeDataRange));
  aPlot.setDomainGridlinesVisible(aGrid.getVerticalGridLines()); // set gridlines for X axis
  aPlot.setDomainGridlinePaint(aGrid.getGridLinesColor()); // set color of domain gridline
  aPlot.setRangeGridlinesVisible(aGrid.getHorizontalGridLines()); // set gridlines for Y axis
  aPlot.setRangeGridlinePaint(aGrid.getGridLinesColor()); // set color of range gridline
}

代码示例来源:origin: us.ihmc/Plotting

public void createXYLineChart(double[] xDATA, double[] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC,
               boolean ISYAXISLOGARITHMIC)
{
 XYDataset dataset = createDataset(xDATA, yDATA);
 JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false);
 chart.setBackgroundPaint(Color.lightGray);
 XYPlot plot = (XYPlot) chart.getPlot();
 NumberAxis rangeAxis, domainAxis;
 if (ISXAXISLOGARITHMIC)
   domainAxis = new LogarithmicAxis(XLABEL);
 else
   domainAxis = new NumberAxis(XLABEL);
 if (ISYAXISLOGARITHMIC)
   rangeAxis = new LogarithmicAxis(YLABEL);
 else
   rangeAxis = new NumberAxis(YLABEL);
 plot.setDomainAxis(domainAxis);
 plot.setRangeAxis(rangeAxis);
 plot.setBackgroundPaint(Color.white);
 plot.setDomainGridlinesVisible(true);
 plot.setDomainGridlinePaint(Color.blue);
 ChartPanel chartPanel = new ChartPanel(chart);
 chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT));
 this.setContentPane(chartPanel);
}

代码示例来源:origin: us.ihmc/ihmc-swing-plotting

public void createXYLineChart(double[][] xDATA, double[][] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT,
               boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC)
{
 XYDataset dataset = createDataset(xDATA, yDATA);
 JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false);
 chart.setBackgroundPaint(Color.lightGray);
 XYPlot plot = (XYPlot) chart.getPlot();
 NumberAxis rangeAxis, domainAxis;
 if (ISXAXISLOGARITHMIC)
   domainAxis = new LogarithmicAxis(XLABEL);
 else
   domainAxis = new NumberAxis(XLABEL);
 if (ISYAXISLOGARITHMIC)
   rangeAxis = new LogarithmicAxis(YLABEL);
 else
   rangeAxis = new NumberAxis(YLABEL);
 plot.setDomainAxis(domainAxis);
 plot.setRangeAxis(rangeAxis);
 plot.setBackgroundPaint(Color.white);
 plot.setDomainGridlinesVisible(true);
 plot.setDomainGridlinePaint(Color.blue);
 ChartPanel chartPanel = new ChartPanel(chart);
 chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT));
 this.setContentPane(chartPanel);
}

代码示例来源:origin: us.ihmc/Plotting

public void createXYLineChart(double[][] xDATA, double[][] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT,
               boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC)
{
 XYDataset dataset = createDataset(xDATA, yDATA);
 JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false);
 chart.setBackgroundPaint(Color.lightGray);
 XYPlot plot = (XYPlot) chart.getPlot();
 NumberAxis rangeAxis, domainAxis;
 if (ISXAXISLOGARITHMIC)
   domainAxis = new LogarithmicAxis(XLABEL);
 else
   domainAxis = new NumberAxis(XLABEL);
 if (ISYAXISLOGARITHMIC)
   rangeAxis = new LogarithmicAxis(YLABEL);
 else
   rangeAxis = new NumberAxis(YLABEL);
 plot.setDomainAxis(domainAxis);
 plot.setRangeAxis(rangeAxis);
 plot.setBackgroundPaint(Color.white);
 plot.setDomainGridlinesVisible(true);
 plot.setDomainGridlinePaint(Color.blue);
 ChartPanel chartPanel = new ChartPanel(chart);
 chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT));
 this.setContentPane(chartPanel);
}

代码示例来源:origin: us.ihmc/ihmc-swing-plotting

public void createXYLineChart(double[] xDATA, double[] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC,
               boolean ISYAXISLOGARITHMIC)
{
 XYDataset dataset = createDataset(xDATA, yDATA);
 JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false);
 chart.setBackgroundPaint(Color.lightGray);
 XYPlot plot = (XYPlot) chart.getPlot();
 NumberAxis rangeAxis, domainAxis;
 if (ISXAXISLOGARITHMIC)
   domainAxis = new LogarithmicAxis(XLABEL);
 else
   domainAxis = new NumberAxis(XLABEL);
 if (ISYAXISLOGARITHMIC)
   rangeAxis = new LogarithmicAxis(YLABEL);
 else
   rangeAxis = new NumberAxis(YLABEL);
 plot.setDomainAxis(domainAxis);
 plot.setRangeAxis(rangeAxis);
 plot.setBackgroundPaint(Color.white);
 plot.setDomainGridlinesVisible(true);
 plot.setDomainGridlinePaint(Color.blue);
 ChartPanel chartPanel = new ChartPanel(chart);
 chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT));
 this.setContentPane(chartPanel);
}

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

public void configureXYPlot(XYPlot plot) {
    plot.setDomainGridlinesVisible(getDomainGridlinesVisible());

相关文章

微信公众号

最新文章

更多

XYPlot类方法