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

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

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

XYPlot.setRangeAxis介绍

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

代码示例

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

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

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

private ValueAxis configureRangeIndex(int index, int dataType) {
  ValueAxis axis = createAxis(dataType);
  axis.setAutoRange(true);
  Font axisFont = axis.getLabelFont().deriveFont(Font.BOLD);
  axis.setLabelFont(axisFont);
  axis.setLabel(String.format("Y%d Samples", index + 1));
  xyPlot.setRangeAxis(index, axis);
  xyPlot.setRangeAxisLocation(index, index == 0 ? AxisLocation.BOTTOM_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT);
  return axis;
}

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

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

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

/**
 * Sets the range axes for this plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 *
 * @param axes  the axes (<code>null</code> not permitted).
 *
 * @see #setDomainAxes(ValueAxis[])
 */
public void setRangeAxes(ValueAxis[] axes) {
  for (int i = 0; i < axes.length; i++) {
    setRangeAxis(i, axes[i], false);
  }
  fireChangeEvent();
}

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

/**
 * Sets the range axes for this plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 *
 * @param axes  the axes ({@code null} not permitted).
 *
 * @see #setDomainAxes(ValueAxis[])
 */
public void setRangeAxes(ValueAxis[] axes) {
  for (int i = 0; i < axes.length; i++) {
    setRangeAxis(i, axes[i], false);
  }
  fireChangeEvent();
}

代码示例来源: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: 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: us.ihmc/simulation-construction-set-tools

private void setYAxis()
{
 ValueAxis axis;
 switch (yAxisScaling)
 {
 case LOGARITHMIC:
   axis = new LogarithmicAxis(xLabel);
   break;
 case CONSTANT:
 default:
   axis = new NumberAxis(xLabel);
   break;
 }
 graph.getXYPlot().setRangeAxis(0, axis);
}

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

private JFreeChart createChart(TimeTableXYDataset chartData) {
  DateAxis dateAxis = new DateAxis("Time");
  dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));
  dateAxis.setTickLabelFont(dateAxis.getTickLabelFont().deriveFont(20f));
  NumberAxis yAxis = new NumberAxis("Count");
  XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator();
  StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(
    toolTipGenerator, null);
  renderer.setOutline(true);
  XYPlot plot = new XYPlot(chartData, dateAxis, yAxis, renderer);
  plot.setOrientation(PlotOrientation.VERTICAL);
  plot.setRangeAxis(yAxis);  // forces recalculation of the axis range
  JFreeChart chart = new JFreeChart("Dogs and Cats",
    JFreeChart.DEFAULT_TITLE_FONT, plot, false);
  new StandardChartTheme("JFree").apply(chart);
  return chart;
}

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

public XYChartBuilder setYAxis(final boolean showAxisValues, final String valueAxisUnitKey)
{
 final NumberAxis yAxis;
 if (showAxisValues == true && valueAxisUnitKey != null) {
  yAxis = new NumberAxis(ThreadLocalUserContext.getLocalizedString(valueAxisUnitKey));
 } else {
  yAxis = new NumberAxis();
 }
 yAxis.setVisible(showAxisValues);
 plot.setRangeAxis(yAxis);
 return this;
}

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

/**
 * The logic which handles the {@link PreferenceId#JMX_PLOTDATASOLVER} events.
 *
 * @param preferenceEvent
 *            the event object
 */
private void processJmxPlotDataSolverEvent(PreferenceEvent preferenceEvent) {
  PlotDataSolver eDataSolver = (PlotDataSolver) preferenceEvent.getPreferenceMap().get(PreferenceId.JmxPlotDataSolver.DATA_SOLVER);
  // Update view
  plotDataSolver = PlotDataSolverFactory.getDataSolver(eDataSolver);
  subplot.setRangeAxis(plotDataSolver.getAxis());
  // Update preferenceStore
  Map<String, String> dataSolverMap = PreferencesUtils.getObject(PreferencesConstants.JMX_PLOT_DATA_SOLVER);
  dataSolverMap.put(currentJmxIdent.getDerivedFullName(), eDataSolver.toString());
  PreferencesUtils.saveObject(PreferencesConstants.JMX_PLOT_DATA_SOLVER, dataSolverMap, false);
}

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

private void updateScalingOfYAxis() {
  final boolean logScaled = scatterPlotModel.yAxisLogScaled;
  final ValueAxis oldAxis = getPlot().getRangeAxis();
  ValueAxis newAxis = StatisticChartStyling.updateScalingOfAxis(logScaled, oldAxis, false);
  getPlot().setRangeAxis(newAxis);
  finishScalingUpdate(yAxisRangeControl, newAxis, oldAxis);
}

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

private void updateScalingOfYAxis() {
  final boolean logScaled = scatterPlotModel.yAxisLogScaled;
  final ValueAxis oldAxis = getPlot().getRangeAxis();
  ValueAxis newAxis = StatisticChartStyling.updateScalingOfAxis(logScaled, oldAxis, false);
  getPlot().setRangeAxis(newAxis);
  finishScalingUpdate(yAxisRangeControl, newAxis, oldAxis);
}

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

private void updateScalingOfYAxis() {
  final boolean logScaled = (Boolean) yAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_LOG_SCALED).getPropertyValue();
  final XYPlot plot = chart.getXYPlot();
  plot.setRangeAxis(StatisticChartStyling.updateScalingOfAxis(logScaled, plot.getRangeAxis(), true));
}

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

private void updateScalingOfYAxis() {
  final boolean logScaled = (Boolean) yAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_LOG_SCALED).getPropertyValue();
  final XYPlot plot = chart.getXYPlot();
  plot.setRangeAxis(StatisticChartStyling.updateScalingOfAxis(logScaled, plot.getRangeAxis(), true));
}

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

public void setData(TimeseriesData data, TimeseriesMetadataOutput timeMetadata, StyleProperties style) {
  getXYPlot().setDataset(timeseriesIndex, createTimeseriesCollection(data, style));
  ValueAxis rangeAxis = createRangeAxis(timeMetadata);
  getXYPlot().setRangeAxis(timeseriesIndex, rangeAxis);
  getXYPlot().mapDatasetToRangeAxis(timeseriesIndex, timeseriesIndex);
}

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

public void setData(Data<QuantityValue> data, DatasetOutput< ? > timeMetadata, StyleProperties style) {
  getXYPlot().setDataset(timeseriesIndex, createTimeseriesCollection(data, style));
  ValueAxis rangeAxis = createRangeAxis(timeMetadata);
  getXYPlot().setRangeAxis(timeseriesIndex, rangeAxis);
  getXYPlot().mapDatasetToRangeAxis(timeseriesIndex, timeseriesIndex);
}

代码示例来源: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);
  }
}

代码示例来源:origin: mdeverdelhan/ta4j-origins

/**
 * Adds the cash flow axis to the plot.
 * @param plot the plot
 * @param dataset the cash flow dataset
 */
private static void addCashFlowAxis(XYPlot plot, TimeSeriesCollection dataset) {
  final NumberAxis cashAxis = new NumberAxis("Cash Flow Ratio");
  cashAxis.setAutoRangeIncludesZero(false);
  plot.setRangeAxis(1, cashAxis);
  plot.setDataset(1, dataset);
  plot.mapDatasetToRangeAxis(1, 1);
  final StandardXYItemRenderer cashFlowRenderer = new StandardXYItemRenderer();
  cashFlowRenderer.setSeriesPaint(0, Color.blue);
  plot.setRenderer(1, cashFlowRenderer);
}

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

private JFreeChart createChart(final String title, final String categoryAxisLabel,
    final String valueAxisLabel, final XYSeriesCollection dataset) {
  JFreeChart c = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel,
      dataset, PlotOrientation.VERTICAL, true, // legend?
      false, // tooltips?
      false // URLs?
      );
  if (this.isLogarithmicAxis){
    XYPlot p = (XYPlot) c.getPlot();
    LogarithmicAxis axis_x = new LogarithmicAxis(this.xAxisLabel);
    LogarithmicAxis axis_y = new LogarithmicAxis(this.yAxisLabel);
    axis_x.setAllowNegativesFlag(false);
    axis_y.setAllowNegativesFlag(false);
    p.setDomainAxis(axis_x);
    p.setRangeAxis(axis_y);
  }
  return c;
}

相关文章

微信公众号

最新文章

更多

XYPlot类方法