Search in sources :

Example 6 with IntervalCategoryDataset

use of org.jfree.data.category.IntervalCategoryDataset in project SIMVA-SoS by SESoS.

the class IntervalCategoryToolTipGenerator method createItemArray.

/**
 * Creates the array of items that can be passed to the
 * <code>MessageFormat</code> class for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The items (never <code>null</code>).
 */
@Override
protected Object[] createItemArray(CategoryDataset dataset, int row, int column) {
    Object[] result = new Object[5];
    result[0] = dataset.getRowKey(row).toString();
    result[1] = dataset.getColumnKey(column).toString();
    Number value = dataset.getValue(row, column);
    if (getNumberFormat() != null) {
        result[2] = getNumberFormat().format(value);
    } else if (getDateFormat() != null) {
        result[2] = getDateFormat().format(value);
    }
    if (dataset instanceof IntervalCategoryDataset) {
        IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
        Number start = icd.getStartValue(row, column);
        Number end = icd.getEndValue(row, column);
        if (getNumberFormat() != null) {
            result[3] = getNumberFormat().format(start);
            result[4] = getNumberFormat().format(end);
        } else if (getDateFormat() != null) {
            result[3] = getDateFormat().format(start);
            result[4] = getDateFormat().format(end);
        }
    }
    return result;
}
Also used : IntervalCategoryDataset(org.jfree.data.category.IntervalCategoryDataset)

Example 7 with IntervalCategoryDataset

use of org.jfree.data.category.IntervalCategoryDataset in project SIMVA-SoS by SESoS.

the class IntervalBarRenderer method drawItem.

/**
 * 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) {
    if (dataset instanceof IntervalCategoryDataset) {
        IntervalCategoryDataset d = (IntervalCategoryDataset) dataset;
        drawInterval(g2, state, dataArea, plot, domainAxis, rangeAxis, d, row, column);
    } else {
        super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, column, pass);
    }
}
Also used : IntervalCategoryDataset(org.jfree.data.category.IntervalCategoryDataset)

Aggregations

IntervalCategoryDataset (org.jfree.data.category.IntervalCategoryDataset)7 Range (org.jfree.data.Range)2 RangeInfo (org.jfree.data.RangeInfo)2 CategoryRangeInfo (org.jfree.data.category.CategoryRangeInfo)2 XYRangeInfo (org.jfree.data.xy.XYRangeInfo)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 BoxAndWhiskerCategoryDataset (org.jfree.data.statistics.BoxAndWhiskerCategoryDataset)1 MultiValueCategoryDataset (org.jfree.data.statistics.MultiValueCategoryDataset)1 StatisticalCategoryDataset (org.jfree.data.statistics.StatisticalCategoryDataset)1