Java Code Examples for org.jfree.chart.plot.CategoryPlot#indexOf()

The following examples show how to use org.jfree.chart.plot.CategoryPlot#indexOf() . 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: LevelRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
        int pass) {

    // nothing is drawn if the row index is not included in the list with
    // the indices of the visible rows...
    int visibleRow = state.getVisibleSeriesIndex(row);
    if (visibleRow < 0) {
        return;
    }

    // nothing is drawn for null values...
    Number dataValue = dataset.getValue(row, column);
    if (dataValue == null) {
        return;
    }

    double value = dataValue.doubleValue();

    PlotOrientation orientation = plot.getOrientation();
    double barW0 = calculateBarW0(plot, orientation, dataArea, domainAxis,
            state, visibleRow, column);
    RectangleEdge edge = plot.getRangeAxisEdge();
    double barL = rangeAxis.valueToJava2D(value, dataArea, edge);

    // draw the bar...
    Line2D line;
    double x, y;
    if (orientation == PlotOrientation.HORIZONTAL) {
        x = barL;
        y = barW0 + state.getBarWidth() / 2.0;
        line = new Line2D.Double(barL, barW0, barL,
                barW0 + state.getBarWidth());
    }
    else {
        x = barW0 + state.getBarWidth() / 2.0;
        y = barL;
        line = new Line2D.Double(barW0, barL, barW0 + state.getBarWidth(),
                barL);
    }
    Stroke itemStroke = getItemStroke(row, column);
    Paint itemPaint = getItemPaint(row, column);
    g2.setStroke(itemStroke);
    g2.setPaint(itemPaint);
    g2.draw(line);

    CategoryItemLabelGenerator generator = getItemLabelGenerator(row,
            column);
    if (generator != null && isItemLabelVisible(row, column)) {
        drawItemLabel(g2, orientation, dataset, row, column, x, y,
                (value < 0.0));
    }

    // submit the current data point as a crosshair candidate
    int datasetIndex = plot.indexOf(dataset);
    updateCrosshairValues(state.getCrosshairState(),
            dataset.getRowKey(row), dataset.getColumnKey(column), value,
            datasetIndex, barW0, barL, orientation);

    // collect entity and tool tip information...
    EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
        addItemEntity(entities, dataset, row, column, line.getBounds());
    }

}
 
Example 2
Source File: LevelRenderer.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
        int pass) {

    // nothing is drawn if the row index is not included in the list with
    // the indices of the visible rows...
    int visibleRow = state.getVisibleSeriesIndex(row);
    if (visibleRow < 0) {
        return;
    }

    // nothing is drawn for null values...
    Number dataValue = dataset.getValue(row, column);
    if (dataValue == null) {
        return;
    }

    double value = dataValue.doubleValue();

    PlotOrientation orientation = plot.getOrientation();
    double barW0 = calculateBarW0(plot, orientation, dataArea, domainAxis,
            state, visibleRow, column);
    RectangleEdge edge = plot.getRangeAxisEdge();
    double barL = rangeAxis.valueToJava2D(value, dataArea, edge);

    // draw the bar...
    Line2D line;
    double x, y;
    if (orientation == PlotOrientation.HORIZONTAL) {
        x = barL;
        y = barW0 + state.getBarWidth() / 2.0;
        line = new Line2D.Double(barL, barW0, barL,
                barW0 + state.getBarWidth());
    }
    else {
        x = barW0 + state.getBarWidth() / 2.0;
        y = barL;
        line = new Line2D.Double(barW0, barL, barW0 + state.getBarWidth(),
                barL);
    }
    Stroke itemStroke = getItemStroke(row, column);
    Paint itemPaint = getItemPaint(row, column);
    g2.setStroke(itemStroke);
    g2.setPaint(itemPaint);
    g2.draw(line);

    CategoryItemLabelGenerator generator = getItemLabelGenerator(row,
            column);
    if (generator != null && isItemLabelVisible(row, column)) {
        drawItemLabel(g2, orientation, dataset, row, column, x, y,
                (value < 0.0));
    }

    // submit the current data point as a crosshair candidate
    int datasetIndex = plot.indexOf(dataset);
    updateCrosshairValues(state.getCrosshairState(),
            dataset.getRowKey(row), dataset.getColumnKey(column), value,
            datasetIndex, barW0, barL, orientation);

    // collect entity and tool tip information...
    EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
        addItemEntity(entities, dataset, row, column, line.getBounds());
    }

}
 
Example 3
Source File: Arja_00112_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 4
Source File: jMutRepair_0020_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 5
Source File: Cardumen_00191_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 6
Source File: JGenProg2017_0044_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 7
Source File: Cardumen_0075_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 8
Source File: Cardumen_0075_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 9
Source File: Arja_0089_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 10
Source File: jKali_0019_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 11
Source File: Arja_00112_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 12
Source File: jKali_000_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 13
Source File: JGenProg2017_00102_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 14
Source File: patch1-Chart-1-jMutRepair_patch1-Chart-1-jMutRepair_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 15
Source File: AbstractCategoryItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 16
Source File: jKali_0019_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 17
Source File: Cardumen_00139_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 18
Source File: jKali_0031_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 19
Source File: 1_AbstractCategoryItemRenderer.java    From SimFix with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}
 
Example 20
Source File: JGenProg2017_000_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Returns the domain axis that is used for the specified dataset.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return A domain axis.
 */
protected CategoryAxis getDomainAxis(CategoryPlot plot, 
        CategoryDataset dataset) {
    int datasetIndex = plot.indexOf(dataset);
    return plot.getDomainAxisForDataset(datasetIndex);
}