org.knowm.xchart.style.XYStyler.setLegendPosition()方法的使用及代码示例

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

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

XYStyler.setLegendPosition介绍

暂无

代码示例

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

chart.getStyler().setLegendPosition(LegendPosition.InsideNE);

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

chart.getStyler().setLegendPosition(LegendPosition.InsideNE);
chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Area);

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

chart.getStyler().setLegendPosition(LegendPosition.InsideNW);

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

static Chart getLineChart() {
 XYChart chart =
   new XYChartBuilder().width(WIDTH).height(HEIGHT).xAxisTitle("X").yAxisTitle("Y").build();
 // Customize Chart
 chart.getStyler().setToolTipsEnabled(true);
 chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
 // generates sine data
 int size = 30;
 List<Integer> xData = new ArrayList<Integer>();
 List<Double> yData = new ArrayList<Double>();
 List<Integer> xData2 = new ArrayList<Integer>();
 List<Double> yData2 = new ArrayList<Double>();
 for (int i = 0; i <= size; i++) {
  double radians = (Math.PI / (size / 2) * i);
  int x = i - size / 2;
  xData.add(x);
  yData.add(-1 * Math.sin(radians));
  xData2.add(x);
  yData2.add(-10 * Math.cos(radians));
 }
 // Series
 chart.addSeries("y=sin(x)", xData, yData);
 chart.addSeries("y=cos(x)", xData2, yData2);
 return chart;
}

代码示例来源: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: knowm/XChart

static Chart getLineChart() {

  XYChart chart =
    new XYChartBuilder().width(WIDTH).height(HEIGHT).xAxisTitle("X").yAxisTitle("Y").build();

  // Customize Chart
  chart.getStyler().setToolTipsEnabled(true);
  chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
  // generates sine data
  int size = 30;
  List<Integer> xData = new ArrayList<Integer>();
  List<Double> yData = new ArrayList<Double>();
  List<Integer> xData2 = new ArrayList<Integer>();
  List<Double> yData2 = new ArrayList<Double>();
  for (int i = 0; i <= size; i++) {
   double radians = (Math.PI / (size / 2) * i);
   int x = i - size / 2;
   xData.add(x);
   yData.add(-1 * Math.sin(radians));
   xData2.add(x);
   yData2.add(-10 * Math.cos(radians));
  }

  // Series
  chart.addSeries("y=sin(x)", xData, yData);
  chart.addSeries("y=cos(x)", xData2, yData2);
  return chart;
 }
}

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

static Chart getLineChart() {

  XYChart chart =
    new XYChartBuilder().width(WIDTH).height(HEIGHT).xAxisTitle("X").yAxisTitle("Y").build();

  // Customize Chart
  chart.getStyler().setToolTipsEnabled(true);
  chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
  // generates sine data
  int size = 30;
  List<Integer> xData = new ArrayList<Integer>();
  List<Double> yData = new ArrayList<Double>();
  List<Integer> xData2 = new ArrayList<Integer>();
  List<Double> yData2 = new ArrayList<Double>();
  for (int i = 0; i <= size; i++) {
   double radians = (Math.PI / (size / 2) * i);
   int x = i - size / 2;
   xData.add(x);
   yData.add(-1 * Math.sin(radians));
   xData2.add(x);
   yData2.add(-10 * Math.cos(radians));
  }

  // Series
  chart.addSeries("y=sin(x)", xData, yData);
  chart.addSeries("y=cos(x)", xData2, yData2);
  return chart;
 }
}

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

chart.getStyler().setLegendPosition(Styler.LegendPosition.OutsideS);
chart.getStyler().setLegendLayout(Styler.LegendLayout.Horizontal);

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

c.setYAxisGroupTitle(1, "B");
c.getStyler().setYAxisGroupPosition(1, Styler.YAxisPosition.Right);
c.getStyler().setLegendPosition(Styler.LegendPosition.InsideNE);

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

chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
chart.getStyler().setYAxisLogarithmic(true);
chart.getStyler().setXAxisLabelRotation(45);

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

chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
chart.getStyler().setYAxisLogarithmic(true);
chart.getStyler().setXAxisLabelRotation(45);

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

@Override
 public XYChart getChart() {

  // Create Chart
  XYChart chart =
    new XYChartBuilder()
      .width(800)
      .height(600)
      .title(getClass().getSimpleName())
      .xAxisTitle("X")
      .yAxisTitle("Y")
      .build();

  // Customize Chart
  chart.getStyler().setLegendPosition(LegendPosition.InsideNE);
  chart.getStyler().setAxisTitlesVisible(false);
  chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Area);

  // Series
  chart.addSeries("a", new double[] {0, 3, 5, 7, 9}, new double[] {-3, 5, 9, 6, 5});
  chart.addSeries("b", new double[] {0, 2, 4, 6, 9}, new double[] {-1, 6, 4, 0, 4});
  chart.addSeries("c", new double[] {0, 1, 3, 8, 9}, new double[] {-2, -1, 1, 0, 1});

  return chart;
 }
}

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

chart.getStyler().setLegendPosition(Styler.LegendPosition.InsideS);

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

@Override
 public XYChart getChart() {

  // Create Chart
  XYChart chart =
    new XYChartBuilder()
      .width(800)
      .height(600)
      .title(getClass().getSimpleName())
      .xAxisTitle("X")
      .yAxisTitle("Y")
      .build();

  // Customize Chart
  chart.getStyler().setLegendPosition(LegendPosition.InsideNE);
  chart.getStyler().setAxisTitlesVisible(false);
  chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.StepArea);

  // Series
  chart.addSeries("a", new double[] {0, 3, 5, 7, 9}, new double[] {-3, 5, 9, 6, 5});
  chart.addSeries("b", new double[] {0, 2, 4, 6, 9}, new double[] {-1, 6, 4, 0, 4});
  chart.addSeries("c", new double[] {0, 1, 3, 8, 9}, new double[] {-2, -1, 1, 0, 1});

  return chart;
 }
}

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

chart.getStyler().setLegendPosition(Styler.LegendPosition.OutsideE);
chart.getStyler().setMarkerSize(5);
chart.getStyler().setAxisTicksVisible(true);

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

chart.getStyler().setLegendPosition(LegendPosition.InsideNE);
chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Area);

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

static Chart getAreaChart() {
 // Create Chart
 XYChart chart =
   new XYChartBuilder()
     .width(WIDTH)
     .height(HEIGHT)
     .title("Area chart")
     .xAxisTitle("X")
     .yAxisTitle("Y")
     .build();
 // Customize Chart
 chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
 chart.getStyler().setAxisTitlesVisible(true);
 chart.setYAxisGroupTitle(0, "a");
 chart.setYAxisGroupTitle(1, "b");
 chart.setYAxisGroupTitle(2, "c");
 chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Area);
 chart.getStyler().setToolTipsEnabled(true);
 // Series
 chart.addSeries("a", new double[] {0, 3, 6, 9, 12}, new double[] {-1, 5, 9, 6, 5});
 chart.addSeries("b", new double[] {1, 4, 7, 10, 13}, new double[] {-10, 50, 90, 60, 50});
 chart.addSeries("c", new double[] {2, 5, 8, 11, 14}, new double[] {-100, 500, 900, 600, 500});
 return chart;
}

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

public static void main(String[] args) {
 // Create Chart
 XYChart chart =
   new XYChartBuilder()
     .width(600)
     .height(500)
     .title("Gaussian Blobs")
     .xAxisTitle("X")
     .yAxisTitle("Y")
     .build();
 // Customize Chart
 chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter);
 chart.getStyler().setChartTitleVisible(false);
 chart.getStyler().setLegendPosition(LegendPosition.InsideSW);
 chart.getStyler().setMarkerSize(16);
 // Series
 chart.addSeries("Gaussian Blob 1", getGaussian(1000, 1, 10), getGaussian(1000, 1, 10));
 XYSeries series =
   chart.addSeries("Gaussian Blob 2", getGaussian(1000, 1, 10), getGaussian(1000, 0, 5));
 series.setMarker(SeriesMarkers.DIAMOND);
 new SwingWrapper(chart).displayChart();
}

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

chart.getStyler().setLegendPosition(LegendPosition.InsideSW);
chart.getStyler().setYAxisLogarithmic(true);
chart.getStyler().setYAxisMin(0.01);

相关文章