org.knowm.xchart.XYChartBuilder类的使用及代码示例

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

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

XYChartBuilder介绍

暂无

代码示例

代码示例来源:origin: knowm/XChange

public XChartPanel<XYChart> buildPanel() throws IOException {
 System.out.println("fetching data...");
 updateData();
 // create chart
 chart =
   new XYChartBuilder()
     .width(800)
     .height(400)
     .title("Real-time Bitcoinium Order Book - BITSTAMP_BTC_USD")
     .xAxisTitle("BTC")
     .yAxisTitle("USD")
     .build();
 // Customize Chart
 chart.getStyler().setLegendPosition(LegendPosition.InsideNE);
 chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Area);
 // add series
 XYSeries series = chart.addSeries(BIDS_SERIES_NAME, xAxisBidData, yAxisBidData);
 series.setMarker(SeriesMarkers.NONE);
 series = chart.addSeries(ASKS_SERIES_NAME, xAxisAskData, yAxisAskData);
 series.setMarker(SeriesMarkers.NONE);
 return new XChartPanel<>(chart);
}

代码示例来源:origin: knowm/XChart

@Override
public XYChart getChart() {
 yData = getRandomData(5);
 // Create Chart
 xyChart =
   new XYChartBuilder()
     .width(500)
     .height(400)
     .theme(ChartTheme.Matlab)
     .title("Real-time XY Chart")
     .build();
 xyChart.addSeries(SERIES_NAME, null, yData);
 return xyChart;
}

代码示例来源:origin: knowm/XChart

th2Data.add((1.1 * i) * (1.1 * i));
XYChart c = new XYChartBuilder().title("Test Data").xAxisTitle("Time").build();
c.setYAxisGroupTitle(0, "A");
c.setYAxisGroupTitle(1, "B");

代码示例来源:origin: knowm/XChart

public static void main(String[] args) throws IOException {

  final XYChart chart = new XYChartBuilder().build();

  final double[] x = {1, 2, 3};
  // final double[] y = { 40.16064257028113, 40.16064257028115, Double.NaN };
  // final double[] y = { 40.16064257028113, 40.16064257028115, Double.NEGATIVE_INFINITY };
  // final double[] y = { 40.16064257028113, 40.16064257028115, Double.POSITIVE_INFINITY };
  // final double[] y = { 40.16064257028113, 40.16064257028115, -Double.MAX_VALUE + 1e308 };
  final double[] y = {40.16064257028113, 40.16064257028115, -1 * Double.MAX_VALUE};

  chart.addSeries("Values", x, y);
  new SwingWrapper(chart).displayChart();
 }
}

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

public void setVarChart(int variable1, int variable2) {
  this.variable1 = variable1;
  this.variable2 = variable2;
  this.varChart = new XYChartBuilder().xAxisTitle("Variable " + this.variable1)
      .yAxisTitle("Variable " + this.variable2).build();
  this.varChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5);
  double[] xData = new double[] { 0 };
  double[] yData = new double[] { 0 };
  XYSeries varChartSeries = this.varChart.addSeries(this.name, xData, yData);
  varChartSeries.setMarkerColor(Color.blue);
  this.charts.put("VAR", this.varChart);
}

代码示例来源:origin: knowm/XChange

new XYChartBuilder()
  .width(800)
  .height(600)
  .title("Real-time Bitstamp Price vs. Time")
  .xAxisTitle("Time")
  .yAxisTitle("Price")
  .build();

代码示例来源:origin: knowm/XChart

public static void main(String[] args) {

  // Create Chart
  XYChart chart = new XYChartBuilder().width(600).height(400).build();

  // Customize Chart

  // Series
  double[] xData1 = new double[] {0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15};
  double[] yData1 = new double[] {106, 44, 26, 10, 11, 19, 25, Double.NaN, 30, 21, 36, 32, 30};
  double[] xData2 = new double[] {6, 7, 8, 9, 10, 11};
  double[] yData2 = new double[] {25, 54, 43, 56, 33, 30};

  chart.addSeries("A", xData1, yData1);
  chart.addSeries("B", xData2, yData2);

  new SwingWrapper<XYChart>(chart).displayChart();
 }
}

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

public void addIndicatorChart(String indicator) {
  XYChart indicatorChart = new XYChartBuilder().xAxisTitle("n").yAxisTitle(indicator).build();
  indicatorChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5);
  List<Integer> indicatorIterations = new ArrayList<Integer>();
  indicatorIterations.add(0);
  List<Double> indicatorValues = new ArrayList<Double>();
  indicatorValues.add(0.0);
  XYSeries indicatorSeries = indicatorChart.addSeries(this.name, indicatorIterations, indicatorValues);
  indicatorSeries.setMarkerColor(Color.blue);
  this.iterations.put(indicator, indicatorIterations);
  this.indicatorValues.put(indicator, indicatorValues);
  this.charts.put(indicator, indicatorChart);
}

代码示例来源:origin: knowm/XChange

new XYChartBuilder()
  .width(800)
  .height(600)
  .title("Mercado Order Book")
  .xAxisTitle("BTC")
  .yAxisTitle("BRL")
  .build();

代码示例来源:origin: knowm/XChart

XYChart chart = new XYChartBuilder().width(800).height(600).title("Year Scale").build();

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

public void setFrontChart(int objective1, int objective2, String referenceFrontFileName) throws FileNotFoundException {
  this.objective1 = objective1;
  this.objective2 = objective2;
  this.frontChart = new XYChartBuilder().xAxisTitle("Objective " + this.objective1)
      .yAxisTitle("Objective " + this.objective2).build();
  this.frontChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5);
  if (referenceFrontFileName != null) {
    this.displayReferenceFront(referenceFrontFileName);
  }
  double[] xData = new double[] { 0 };
  double[] yData = new double[] { 0 };
  XYSeries frontChartSeries = this.frontChart.addSeries(this.name, xData, yData);
  frontChartSeries.setMarkerColor(Color.blue);
  this.charts.put("Front", this.frontChart);
}

代码示例来源:origin: knowm/XChange

new XYChartBuilder()
  .width(800)
  .height(600)
  .title("Bitstamp Price vs. Date")
  .xAxisTitle("Date")
  .yAxisTitle("Price")
  .build();

代码示例来源:origin: knowm/XChart

XYChart chart = new XYChartBuilder().width(800).height(600).title("Day Scale").build();

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

public void setFrontChart(int objective1, int objective2, String referenceFrontFileName) throws FileNotFoundException {
 this.objective1 = objective1;
 this.objective2 = objective2;
 this.frontChart = new XYChartBuilder().xAxisTitle("Objective " + this.objective1)
   .yAxisTitle("Objective " + this.objective2).build();
 this.frontChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5);
 if (referenceFrontFileName != null) {
  this.displayReferenceFront(referenceFrontFileName);
 }
 double[] xData = new double[] { 0 };
 double[] yData = new double[] { 0 };
 XYSeries frontChartSeries = this.frontChart.addSeries(this.name, xData, yData);
 frontChartSeries.setMarkerColor(Color.blue);
 this.charts.put("Front", this.frontChart);
}

代码示例来源:origin: knowm/XChange

new XYChartBuilder()
  .width(800)
  .height(600)
  .title("Bitstamp Order Book")
  .xAxisTitle("BTC")
  .yAxisTitle("EUR")
  .build();

代码示例来源:origin: knowm/XChart

XYChart chart = new XYChartBuilder().width(800).height(600).title("Month Scale").build();

代码示例来源:origin: signaflo/java-timeseries

/**
 * Plot a data set. This method will produce a scatter plot of the data values against the integers
 * from 0 to n - 1, where n is the size of the data set.
 *
 * @param dataSet the data set to plot.
 */
public static void plot(final DataSet dataSet) {
  Thread plotThread = new Thread(() -> {
    final double[] indices = new double[dataSet.size()];
    for (int i = 0; i < indices.length; i++) {
      indices[i] = i;
    }
    XYChart chart = new XYChartBuilder().theme(Styler.ChartTheme.GGPlot2).
        title("Scatter Plot").xAxisTitle("Index").yAxisTitle("Values").build();
    chart.getStyler().setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter).
        setChartFontColor(Color.BLACK).setSeriesColors(new Color[]{Color.BLUE});
    chart.addSeries("com/github/signaflo/data", indices, dataSet.asArray());
    JPanel panel = new XChartPanel<>(chart);
    JFrame frame = new JFrame("Data Set");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);
  });
  plotThread.start();
}

代码示例来源:origin: knowm/XChange

new XYChartBuilder()
  .width(800)
  .height(600)
  .title("Cryptopia Order Book")
  .xAxisTitle("BTC")
  .yAxisTitle("ETH")
  .build();

代码示例来源:origin: knowm/XChart

@Override
 public XYChart getChart() {

  // Create Chart
  XYChart chart = new XYChartBuilder().width(800).height(600).title("Logarithmic Data").build();

  // Customize Chart
  chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter);
  chart.getStyler().setXAxisLogarithmic(true);
  chart.getStyler().setLegendPosition(LegendPosition.InsideN);

  // Series
  List<Double> xData = new ArrayList<Double>();
  List<Double> yData = new ArrayList<Double>();
  Random random = new Random();
  int size = 400;
  for (int i = 0; i < size; i++) {
   double nextRandom = random.nextDouble();
   xData.add(Math.pow(10, nextRandom * 10));
   yData.add(1000000000.0 + nextRandom);
  }
  chart.addSeries("logarithmic data", xData, yData);

  return chart;
 }
}

代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI

private static XYChart getChart(String title, EvaluationReport er) {
  // Create Chart
  XYChart chart = new XYChartBuilder().title("Performance").xAxisTitle("Evaluation").yAxisTitle("Value").build();
   // Customize Chart
  chart.getStyler().setLegendPosition(LegendPosition.OutsideS);
  chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Line);
  chart.getStyler().setYAxisLabelAlignment(Styler.TextAlignment.Right);
  chart.getStyler().setPlotMargin(0);
  chart.getStyler().setPlotContentSize(.95);
   String[] labels = er.getSeriesLabels();
  int lines = labels.length;
  int lineSize = er.getSeries(labels[0]).size();
  
  double[] xAges = new double[lineSize];
  for(int i=0; i<lineSize; i++) xAges[i] = i;
  
  for( int l=0; l<lines; l++)
  {
    Double[] line = er.getSeries(labels[l]).toArray(new Double[0]);
    chart.addSeries(labels[l], xAges, ArrayUtils.toPrimitive(line));
  }
   return chart;
}

相关文章