org.jfree.chart.JFreeChart.getCategoryPlot()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(201)

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

JFreeChart.getCategoryPlot介绍

[英]Returns the plot cast as a CategoryPlot.

NOTE: if the plot is not an instance of CategoryPlot, then a ClassCastException is thrown.
[中]返回作为CategoryPlot强制转换的绘图。
注意:如果绘图不是CategoryPlot的实例,则抛出ClassCastException。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Draws a chart into {@link JFreeChart}.
 */
public JFreeChart createChart() {
  final JFreeChart chart = ChartFactory.createLineChart(null, // chart title
      null, // unused
      null, // range axis label
      dataset, // data
      PlotOrientation.VERTICAL, // orientation
      true, // include legend
      true, // tooltips
      false // urls
      );
  chart.setBackgroundPaint(Color.white);
  chart.getLegend().setItemFont(CHART_FONT);
  final CategoryPlot plot = chart.getCategoryPlot();
  configurePlot(plot);
  configureRangeAxis((NumberAxis) plot.getRangeAxis());
  crop(plot);
  return chart;
}

代码示例来源:origin: jenkinsci/jenkins

final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);

代码示例来源:origin: jenkinsci/jenkins

final CategoryPlot plot = chart.getCategoryPlot();

代码示例来源:origin: fossasia/neurolab-desktop

lineChart.getTitle().setFont(new Font("Ubuntu", Font.PLAIN, 20));
lineChart.getPlot().setOutlineStroke(new BasicStroke(3));
lineChart.getCategoryPlot().getRenderer().setSeriesStroke(0, new BasicStroke(3));
lineChart.getCategoryPlot().getRenderer().setSeriesStroke(1, new BasicStroke(3));

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

CategoryPlot topPlot = bcTop.getCategoryPlot();
NumberAxis topAxis = (NumberAxis) topPlot.getRangeAxis();
topAxis.setLowerBound(1500);
CategoryPlot mainPlot = bc.getCategoryPlot();
combinedPlot.add(mainPlot, 5);

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

@Override
public void customize(JFreeChart chart, JRChart jasperChart) {
  LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer();

  renderer.setSeriesLinesVisible(0, false);
  renderer.setSeriesShapesVisible(0, false);

  etc ....
}

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

public class TSChartCustomizer extends JRAbstractChartCustomizer {
  public void customize(JFreeChart chart, JRChart jasperChart) {
    AbstractCategoryItemRenderer renderer = (AbstractCategoryItemRenderer) chart.getCategoryPlot().getRenderer();
    BasicStroke stroke = new BasicStroke(3f);
    renderer.setSeriesStroke(0, stroke);
  }
}

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

...
XYDataset dataset = createDataset();
JFreeChart chart = createChart(dataset);
CategoryAxis categoryAxis = chart.getCategoryPlot().getDomainAxis();
categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
// categoryAxis.setVerticalTickLabels(true);
...

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

private class ChartCustomizer implements DRIChartCustomizer, Serializable {  
  public void customize(JFreeChart chart, ReportParameters reportParameters) {  
   CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis();  
   domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI/2));
  }  
}

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

final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "",
       dataset, PlotOrientation.VERTICAL, true, true, false);
CategoryPlot plot = chart.getCategoryPlot();
plot.getDomainAxis(1).setVisible(false);

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

public String render(Comparable key)
  {
    GroupedCategoryDataset dataset = (GroupedCategoryDataset)chart.getCategoryPlot().getDataset();
    Comparable orgRowKey = dataset.getOriginalRowKey(key);
    return orgRowKey.toString();
  }
}

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

JFreeChart chart = makeChart();
CategoryPlot plot = chart.getCategoryPlot();

CategoryAxis axis = new CategoryLabelCustomizableCategoryAxis();
axis.setCategoryLabelGenerator(new MyCategoryLabelGenerator());
plot.setDomainAxis(axis);

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

/**
   * {@inheritDoc}
   */
  @Override
  public void customize(JFreeChart chart, ReportParameters reportParameters) {
    if (chart.getPlot() instanceof CategoryPlot) {
      CategoryDataset dataset = new SeriesOrderCategoryDataset(chart.getCategoryPlot().getDataset(), seriesOrderBy, seriesOrderType);
      chart.getCategoryPlot().setDataset(dataset);
    }
  }
}

代码示例来源:origin: mikaelhg/openblocks

public String getCSV() {
  StringBuilder output = new StringBuilder();
  DefaultCategoryDataset d = (DefaultCategoryDataset) chart.getCategoryPlot().getDataset();
  for (int i = 0; i < d.getRowCount(); i++) {
    output.append(d.getRowKey(i) + "," + d.getValue(d.getRowKey(i), Integer.valueOf(0)) + "\n");
  }
  return output.toString();
}

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

public class CustomFontCategoryChartCustomizer implements JRChartCustomizer  {
  @Override
  public void customize(JFreeChart chart, JRChart jasperChart) {
    Font customFont = new Font("DejaVu Serif", Font.PLAIN, 9);
    CategoryPlot plot = chart.getCategoryPlot();

    // Set legend's font        
    chart.getLegend().setItemFont(customFont);
    // Set categories label's font
    plot.getDomainAxis().setTickLabelFont(customFont);
    // Set amounts label's font 
    plot.getRangeAxis().setTickLabelFont(customFont);
  }
}

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

@Override
  public void customize(JFreeChart chart, ReportParameters reportParameters) {
    BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
    renderer.setShadowPaint(Color.LIGHT_GRAY);
    renderer.setShadowVisible(true);
    CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
  }
}

代码示例来源:origin: mikaelhg/openblocks

public JFreeChart makeChart() {
    JFreeChart chart;
    chart = ChartFactory.createBarChart3D("", "", "",
        new DefaultCategoryDataset(), PlotOrientation.VERTICAL, false, false, false);
    ValueAxis rangeAxis = chart.getCategoryPlot().getRangeAxis();
    if (rangeAxis instanceof NumberAxis) {
      ((NumberAxis) rangeAxis).setNumberFormatOverride(new DecimalFormat("######.###"));
    }
    return chart;
  }
}

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

@Override
  public void customize(JFreeChart chart, ReportParameters reportParameters) {
    BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
  }
}

代码示例来源:origin: superad/pdf-kit

protected void initPlot(JFreeChart chart, DefaultCategoryDataset dataSet) {
  CategoryPlot plot = chart.getCategoryPlot();
  super.initDefaultXYPlot(plot);
  //设置节点的值显示
  LineAndShapeRenderer lineRender = new LineAndShapeRenderer();
  lineRender.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
  lineRender.setBaseItemLabelsVisible(true);
  lineRender.setBasePositiveItemLabelPosition(
      new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));
  plot.setRenderer(lineRender);
}
@Override

代码示例来源:origin: superad/pdf-kit

private  void  initDefaultPlot(JFreeChart  chart,DefaultCategoryDataset dataSet){
  //设置公共颜色
  chart.getTitle().setFont(FontUtil.getFont(Font.PLAIN, 15)); // 设置标题字体
  chart.getLegend().setItemFont(FontUtil.getFont(Font.PLAIN, 13));// 设置图例类别字体
  chart.setBackgroundPaint(Color.white);// 设置背景色
  CategoryPlot plot = chart.getCategoryPlot();
  plot.setNoDataMessage("无对应的数据。");
  plot.setNoDataMessageFont(FontUtil.getFont(Font.PLAIN, 13));//字体的大小
  plot.setNoDataMessagePaint(Color.RED);//字体颜色
  //设置自定义颜色
  initPlot(chart,dataSet);
}

相关文章