List of usage examples for org.jfree.data.statistics BoxAndWhiskerCategoryDataset getRowCount
public int getRowCount();
From source file:edu.ucla.stat.SOCR.chart.demo.BoxAndWhiskerChartDemo1.java
/** * Creates a sample chart./*from w w w .ja va2s .c o m*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(null); NumberAxis rangeAxis = new NumberAxis(rangeLabel); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(chartTitle, plot); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); renderer.setLegendItemLabelGenerator( new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT)); //RowCount -- serie count if (dataset.getColumnCount() * dataset.getRowCount() < 5) { domainAxis.setLowerMargin(0.2); domainAxis.setUpperMargin(0.2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); /* System.out.println("1lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ } else if (dataset.getColumnCount() * dataset.getRowCount() < 10) { domainAxis.setLowerMargin(domainAxis.getLowerMargin() * 2); domainAxis.setUpperMargin(domainAxis.getUpperMargin() * 2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(renderer.getItemMargin() * 2); else domainAxis.setCategoryMargin(domainAxis.getCategoryMargin() * 2); /*System.out.println("2lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ } if (legendPanelOn) chart.removeLegend(); return chart; }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator.java
private JFreeChart createBoxAndWhiskerChart(String title, String xLabel, String yLabel, BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(xLabel); NumberAxis rangeAxis = new NumberAxis(yLabel); // CategoryItemRenderer renderer = new BoxAndWhiskerRenderer(); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(title, plot); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //columnCount -- category count //RowCount -- serie count if (dataset.getColumnCount() * dataset.getRowCount() < 5) { domainAxis.setLowerMargin(0.2);//from w ww . j a v a 2 s .com domainAxis.setUpperMargin(0.2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); /* System.out.println("lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ } else if (dataset.getColumnCount() * dataset.getRowCount() < 10) { domainAxis.setLowerMargin(domainAxis.getLowerMargin() * 2); domainAxis.setUpperMargin(domainAxis.getUpperMargin() * 2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(renderer.getItemMargin() * 2); else domainAxis.setCategoryMargin(domainAxis.getCategoryMargin() * 2); /*System.out.println("lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin()); */ } return chart; }
From source file:edu.ucla.stat.SOCR.analyses.gui.Chart.java
private JFreeChart createBoxAndWhiskerChart(String title, String xLabel, String yLabel, BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(xLabel); NumberAxis rangeAxis = new NumberAxis(yLabel); // CategoryItemRenderer renderer = new BoxAndWhiskerRenderer(); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(title, plot); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //columnCount -- category count //RowCount -- serie count if (dataset.getColumnCount() * dataset.getRowCount() < 5) { domainAxis.setLowerMargin(0.2);/* w ww . j a v a 2 s. com*/ domainAxis.setUpperMargin(0.2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); //System.out.println("lowerMargin="+domainAxis.getLowerMargin()); //System.out.println("ItemMargin="+renderer.getItemMargin()); //System.out.println("CategoryMargin="+domainAxis.getCategoryMargin()); } else if (dataset.getColumnCount() * dataset.getRowCount() < 10) { domainAxis.setLowerMargin(domainAxis.getLowerMargin() * 2); domainAxis.setUpperMargin(domainAxis.getUpperMargin() * 2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(renderer.getItemMargin() * 2); else domainAxis.setCategoryMargin(domainAxis.getCategoryMargin() * 2); //System.out.println("lowerMargin="+domainAxis.getLowerMargin()); //System.out.println("ItemMargin="+renderer.getItemMargin()); //System.out.println("CategoryMargin="+domainAxis.getCategoryMargin()); } return chart; }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java
private JFreeChart createBoxAndWhiskerChart(String title, String xLabel, String yLabel, BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(xLabel); NumberAxis rangeAxis = new NumberAxis(yLabel); // CategoryItemRenderer renderer = new BoxAndWhiskerRenderer(); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(title, plot); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //columnCount -- category count //RowCount -- serie count if (dataset.getColumnCount() * dataset.getRowCount() < 5) { domainAxis.setLowerMargin(0.2);/* ww w . ja v a 2s . co m*/ domainAxis.setUpperMargin(0.2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); } else if (dataset.getColumnCount() * dataset.getRowCount() < 10) { domainAxis.setLowerMargin(domainAxis.getLowerMargin() * 2); domainAxis.setUpperMargin(domainAxis.getUpperMargin() * 2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(renderer.getItemMargin() * 2); else domainAxis.setCategoryMargin(domainAxis.getCategoryMargin() * 2); } return chart; }