Java Code Examples for org.jfree.data.category.CategoryDataset#getRowIndex()

The following examples show how to use org.jfree.data.category.CategoryDataset#getRowIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CategoryAxis.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a
 * category.
 *
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 &lt;= itemMargin &lt; 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 *
 * @return The coordinate in Java2D space.
 *
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category,
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {

    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area,
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 2
Source File: CategoryAxis.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a
 * category.
 *
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 &lt;= itemMargin &lt; 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 *
 * @return The coordinate in Java2D space.
 *
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category,
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {

    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area,
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 3
Source File: CategoryAxis.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a
 * category.
 *
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 &lt;= itemMargin &lt; 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 *
 * @return The coordinate in Java2D space.
 *
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category,
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {

    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area,
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 4
Source File: CategoryAxis.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a
 * category.
 *
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 <= itemMargin < 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 *
 * @return The coordinate in Java2D space.
 *
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category,
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {

    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area,
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 5
Source File: CategoryAxis.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a
 * category.
 *
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 &lt;= itemMargin &lt; 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 *
 * @return The coordinate in Java2D space.
 *
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category,
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {

    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area,
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 6
Source File: CategoryAxis.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a
 * category.
 *
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 &lt;= itemMargin &lt; 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 *
 * @return The coordinate in Java2D space.
 *
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category,
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {

    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area,
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 7
Source File: CategoryAxis.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the middle coordinate (in Java2D space) for a series within a 
 * category.
 * 
 * @param category  the category (<code>null</code> not permitted).
 * @param seriesKey  the series key (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param itemMargin  the item margin (0.0 <= itemMargin < 1.0);
 * @param area  the area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 * 
 * @return The coordinate in Java2D space.
 * 
 * @since 1.0.7
 */
public double getCategorySeriesMiddle(Comparable category, 
        Comparable seriesKey, CategoryDataset dataset, double itemMargin,
        Rectangle2D area, RectangleEdge edge) {
    
    int categoryIndex = dataset.getColumnIndex(category);
    int categoryCount = dataset.getColumnCount();
    int seriesIndex = dataset.getRowIndex(seriesKey);
    int seriesCount = dataset.getRowCount();
    double start = getCategoryStart(categoryIndex, categoryCount, area, 
            edge);
    double end = getCategoryEnd(categoryIndex, categoryCount, area, edge);
    double width = end - start;
    if (seriesCount == 1) {
        return start + width / 2.0;
    }
    else {
        double gap = (width * itemMargin) / (seriesCount - 1);
        double ww = (width * (1 - itemMargin)) / seriesCount;
        return start + (seriesIndex * (ww + gap)) + ww / 2.0;
    }
}
 
Example 8
Source File: CategoryItemEntity.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new entity instance for an item in the specified dataset.
 *
 * @param area  the 'hotspot' area (<code>null</code> not permitted).
 * @param toolTipText  the tool tip text.
 * @param urlText  the URL text.
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key (<code>null</code> not permitted).
 * @param columnKey  the column key (<code>null</code> not permitted).
 *
 * @since 1.0.6
 */
public CategoryItemEntity(Shape area, String toolTipText, String urlText,
        CategoryDataset dataset, Comparable rowKey, Comparable columnKey) {
    super(area, toolTipText, urlText);
    ParamChecks.nullNotPermitted(dataset, "dataset");
    this.dataset = dataset;
    this.rowKey = rowKey;
    this.columnKey = columnKey;

    // populate the deprecated fields
    this.series = dataset.getRowIndex(rowKey);
    this.category = columnKey;
    this.categoryIndex = dataset.getColumnIndex(columnKey);
}
 
Example 9
Source File: CategoryItemEntity.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new entity instance for an item in the specified dataset.
 *
 * @param area  the 'hotspot' area (<code>null</code> not permitted).
 * @param toolTipText  the tool tip text.
 * @param urlText  the URL text.
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key (<code>null</code> not permitted).
 * @param columnKey  the column key (<code>null</code> not permitted).
 *
 * @since 1.0.6
 */
public CategoryItemEntity(Shape area, String toolTipText, String urlText,
        CategoryDataset dataset, Comparable rowKey, Comparable columnKey) {
    super(area, toolTipText, urlText);
    ParamChecks.nullNotPermitted(dataset, "dataset");
    this.dataset = dataset;
    this.rowKey = rowKey;
    this.columnKey = columnKey;

    // populate the deprecated fields
    this.series = dataset.getRowIndex(rowKey);
    this.category = columnKey;
    this.categoryIndex = dataset.getColumnIndex(columnKey);
}
 
Example 10
Source File: CategoryItemEntity.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new entity instance for an item in the specified dataset.
 *
 * @param area  the 'hotspot' area (<code>null</code> not permitted).
 * @param toolTipText  the tool tip text.
 * @param urlText  the URL text.
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key (<code>null</code> not permitted).
 * @param columnKey  the column key (<code>null</code> not permitted).
 *
 * @since 1.0.6
 */
public CategoryItemEntity(Shape area, String toolTipText, String urlText,
        CategoryDataset dataset, Comparable rowKey, Comparable columnKey) {
    super(area, toolTipText, urlText);
    ParamChecks.nullNotPermitted(dataset, "dataset");
    this.dataset = dataset;
    this.rowKey = rowKey;
    this.columnKey = columnKey;

    // populate the deprecated fields
    this.series = dataset.getRowIndex(rowKey);
    this.category = columnKey;
    this.categoryIndex = dataset.getColumnIndex(columnKey);
}
 
Example 11
Source File: Cardumen_0079_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset, 
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 12
Source File: DatasetUtilities.java    From SIMVA-SoS with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 13
Source File: DatasetUtilities.java    From ccu-historian with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 14
Source File: DatasetUtilities.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 15
Source File: JGenProg2017_0047_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset, 
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 16
Source File: JGenProg2017_0047_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset, 
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 17
Source File: Chart_2_DatasetUtilities_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 18
Source File: DatasetUtilities.java    From buffer_bci with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 19
Source File: DatasetUtilities.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}
 
Example 20
Source File: DatasetUtilities.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param rowKey  the row key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset, 
                                                Comparable rowKey) {
    int row = dataset.getRowIndex(rowKey);
    return createPieDatasetForRow(dataset, row);
}