Example usage for org.jfree.data.statistics BoxAndWhiskerCategoryDataset getColumnCount

List of usage examples for org.jfree.data.statistics BoxAndWhiskerCategoryDataset getColumnCount

Introduction

In this page you can find the example usage for org.jfree.data.statistics BoxAndWhiskerCategoryDataset getColumnCount.

Prototype

public int getColumnCount();

Source Link

Document

Returns the number of columns in the table.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.BoxAndWhiskerChartDemo1.java

/**
 * Creates a sample chart./*www.  j ava  2s  .  c om*/
 * 
 * @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);/* w ww .  ja  v  a  2 s. co  m*/
        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.demo.BoxAndWhiskerChartDemo2.java

/**
 * Creates a sample chart.//  w ww.j  ava 2s  .  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);
    plot.setOrientation(PlotOrientation.HORIZONTAL);

    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));

    //columnCount -- category count
    //RowCount -- serie count

    domainAxis.setLowerMargin(0.44);
    domainAxis.setUpperMargin(0.44);
    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());*/

    renderer.setItemMargin(renderer.getItemMargin() * 2);

    /*System.out.println("2lowerMargin="+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);/*from w  w w.j a  v a2s .co  m*/
        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);/*from www .  j  a  va2 s.c  om*/
        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;
}