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

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

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

XYPlot.setDomainAxis介绍

[英]Sets a domain axis and sends a PlotChangeEvent to all registered listeners.
[中]设置域轴并向所有注册的侦听器发送PlotChangeEvent。

代码示例

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

// Create an XY Line chart
XYSeries series = new XYSeries("Random Data");
series.add(1.0, 500.2);
series.add(10.0, 694.1);
XYSeriesCollection data = new XYSeriesCollection(series);
JFreeChart chart = ChartFactory.createXYLineChart("XY Series Demo", "X", "Y", data,
                         PlotOrientation.VERTICAL, 
                         true, true, false);

// Create an NumberAxis
NumberAxis xAxis = new NumberAxis();
xAxis.setTickUnit(new NumberTickUnit(2));

// Assign it to the chart
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainAxis(xAxis);

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

/**
 * Sets the domain axis for the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 *
 * @param axis  the new axis ({@code null} permitted).
 *
 * @see #getDomainAxis()
 * @see #setDomainAxis(int, ValueAxis)
 */
public void setDomainAxis(ValueAxis axis) {
  setDomainAxis(0, axis);
}

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

/**
 * Sets the domain axis for the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 *
 * @param axis  the new axis (<code>null</code> permitted).
 *
 * @see #getDomainAxis()
 * @see #setDomainAxis(int, ValueAxis)
 */
public void setDomainAxis(ValueAxis axis) {
  setDomainAxis(0, axis);
}

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

/**
 * Sets a domain axis and sends a {@link PlotChangeEvent} to all
 * registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis (<code>null</code> permitted).
 *
 * @see #getDomainAxis(int)
 * @see #setRangeAxis(int, ValueAxis)
 */
public void setDomainAxis(int index, ValueAxis axis) {
  setDomainAxis(index, axis, true);
}

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

/**
 * Sets a domain axis and sends a {@link PlotChangeEvent} to all
 * registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis ({@code null} permitted).
 *
 * @see #getDomainAxis(int)
 * @see #setRangeAxis(int, ValueAxis)
 */
public void setDomainAxis(int index, ValueAxis axis) {
  setDomainAxis(index, axis, true);
}

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

chart.getXYPlot().setDomainAxis(0, new DateAxis());
chart.getXYPlot().setDomainAxis(1, new DateAxis());
chart.getXYPlot().setInsets(new RectangleInsets(-15, 0, 0, 10));

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

XYPlot plot = chart.getXYPlot();
DateAxis axis = new DateAxis();
plot.setDomainAxis(axis);
axis.setDateFormatOverride(new SimpleDateFormat("yyyy"));

代码示例来源: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: stackoverflow.com

ChartPanel chartPanel1 = createDemoPanel("Chart1");
ChartPanel chartPanel2 = createDemoPanel("Chart2");
XYPlot plot1 = chartPanel1.getChart().getXYPlot();
XYPlot plot2 = chartPanel2.getChart().getXYPlot();
plot2.setDomainAxis(plot1.getDomainAxis());
chartPanel1.setLayout(new GridLayout());
chartPanel2.setLayout(new GridLayout());
JSplitPane splitPane = new JSplitPane(
  JSplitPane.VERTICAL_SPLIT, chartPanel1, chartPanel2);
add(splitPane, BorderLayout.CENTER);

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

@Override
  public void propertyChange(PropertyChangeEvent evt) {
    ValueAxis oldAxis = chart.getXYPlot().getDomainAxis();
    ValueAxis newAxis = StatisticChartStyling.updateScalingOfAxis((Boolean) evt.getNewValue(), oldAxis, true);
    chart.getXYPlot().setDomainAxis(newAxis);
  }
});

代码示例来源:origin: afranken/jmeter-analysis-maven-plugin

private static XYPlot createPlot(ValueAxis domainAxis, ValueAxis... rangesAxis) {
  XYPlot plot = new XYPlot();
  plot.setDomainAxis(domainAxis);
  int i = 0;
  for (ValueAxis rangeAxis : rangesAxis) {
    plot.setRangeAxis(i++, rangeAxis);
  }
  return defaultPlot(plot);
}

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

JFreeChart chart1 = ChartFactory.createXYLineChart();
JFreeChart chart2 = ChartFactory.createXYLineChart();
XYPlot plot1 = chart1.getXYPlot();
XYPlot plot2 = chart2.getXYPlot();

plot2.setDomainAxis(plot1.getDomainAxis());

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

@Override
  public void propertyChange(PropertyChangeEvent evt) {
    ValueAxis oldAxis = chart.getXYPlot().getDomainAxis();
    ValueAxis newAxis = StatisticChartStyling.updateScalingOfAxis((Boolean) evt.getNewValue(), oldAxis, true);
    chart.getXYPlot().setDomainAxis(newAxis);
  }
});

代码示例来源:origin: org.codehaus.mojo/chronos-report-maven-plugin

public void createThroughputChart( HistoricSamples samples, String dataId )
  throws IOException
{
  XYPlot xyplot = newPlot( samples.getThroughput( dataId ), "chronos.label.throughput.requests", true );
  xyplot.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
  xyplot.getRenderer().setSeriesPaint( 0, Color.GREEN );
  String timeLabel = bundle.getString( "chronos.label.throughput.historytime" );
  DateAxis timeAxis = ChartUtil.createTimeAxis( timeLabel, new SimpleDateFormat() );
  xyplot.setDomainAxis( timeAxis );
  JFreeChart chart = new JFreeChart( bundle.getString( "chronos.label.throughput" ), xyplot );
  renderer.renderChart( "history-throughput-" + dataId, chart );
}

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

private JFreeChart createChart(TimeTableXYDataset chartData) {
  JFreeChart chart = ChartFactory.createStackedXYAreaChart(
    "Dogs and Cats", "Time", "Count", chartData,
    PlotOrientation.VERTICAL, false, true, false);
  DateAxis dateAxis = new DateAxis();
  dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));
  dateAxis.setTickLabelFont(dateAxis.getTickLabelFont().deriveFont(20f));
  XYPlot plot = (XYPlot) chart.getPlot();
  plot.setDomainAxis(dateAxis);
  return chart;
}

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

private void configureDomainAxis(int index, String nameX, int dataType) {
  ValueAxis axis = createAxis(dataType);
  axis.setAutoRange(true);
  axis.setAutoRangeMinimumSize(2);
  axis.setLabel(nameX);
  Font axisFont = axis.getLabelFont().deriveFont(Font.BOLD);
  axis.setLabelFont(axisFont);
  xyPlot.setDomainAxis(index, axis);
}

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

public XYChartBuilder setDateXAxis(final boolean showAxisValues)
{
 xAxis = new DateAxis();
 ((DateAxis) xAxis).setTickMarkPosition(DateTickMarkPosition.MIDDLE);
 xAxis.setLowerMargin(0.0);
 xAxis.setUpperMargin(0.0);
 xAxis.setVisible(showAxisValues);
 plot.setDomainAxis(xAxis);
 return this;
}

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

private void updateScalingOfXAxis() {
  final boolean logScaled = scatterPlotModel.xAxisLogScaled;
  final ValueAxis oldAxis = getPlot().getDomainAxis();
  ValueAxis newAxis = StatisticChartStyling.updateScalingOfAxis(logScaled, oldAxis, false);
  oldAxis.removeChangeListener(domainAxisChangeListener);
  newAxis.addChangeListener(domainAxisChangeListener);
  getPlot().setDomainAxis(newAxis);
  finishScalingUpdate(xAxisRangeControl, newAxis, oldAxis);
}

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

private void updateScalingOfXAxis() {
  final boolean logScaled = scatterPlotModel.xAxisLogScaled;
  final ValueAxis oldAxis = getPlot().getDomainAxis();
  ValueAxis newAxis = StatisticChartStyling.updateScalingOfAxis(logScaled, oldAxis, false);
  oldAxis.removeChangeListener(domainAxisChangeListener);
  newAxis.addChangeListener(domainAxisChangeListener);
  getPlot().setDomainAxis(newAxis);
  finishScalingUpdate(xAxisRangeControl, newAxis, oldAxis);
}

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

public void setLogScale(boolean range, boolean domain) {
  if( domain ) {
    NumberAxis axis = (NumberAxis)plot.getDomainAxis();
    axis = new LogarithmicAxis(axis.getLabel());
    plot.setDomainAxis(axis);
  }
  if( range ) {
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
    axis = new LogarithmicAxis(axis.getLabel());
    plot.setRangeAxis(axis);
  }
}

相关文章

微信公众号

最新文章

更多

XYPlot类方法