use of org.jfree.chart.urls.CategoryURLGenerator in project SIMVA-SoS by SESoS.
the class StackedBarChartTest method testSetSeriesURLGenerator.
/**
* Check that setting a URL generator for a series does override the
* default generator.
*/
@Test
public void testSetSeriesURLGenerator() {
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
CategoryItemRenderer renderer = plot.getRenderer();
StandardCategoryURLGenerator url1 = new StandardCategoryURLGenerator();
renderer.setSeriesItemURLGenerator(0, url1);
CategoryURLGenerator url2 = renderer.getItemURLGenerator(0, 0);
assertTrue(url2 == url1);
}
use of org.jfree.chart.urls.CategoryURLGenerator in project SIMVA-SoS by SESoS.
the class AbstractCategoryItemRenderer method addEntity.
/**
* Adds an entity to the collection.
*
* @param entities the entity collection being populated.
* @param hotspot the entity area (if <code>null</code> a default will be
* used).
* @param dataset the dataset.
* @param row the series.
* @param column the item.
* @param entityX the entity's center x-coordinate in user space (only
* used if <code>area</code> is <code>null</code>).
* @param entityY the entity's center y-coordinate in user space (only
* used if <code>area</code> is <code>null</code>).
*
* @since 1.0.13
*/
protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, double entityX, double entityY) {
if (!getItemCreateEntity(row, column)) {
return;
}
Shape s = hotspot;
if (hotspot == null) {
double r = getDefaultEntityRadius();
double w = r * 2;
if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
} else {
s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
}
}
String tip = null;
CategoryToolTipGenerator generator = getToolTipGenerator(row, column);
if (generator != null) {
tip = generator.generateToolTip(dataset, row, column);
}
String url = null;
CategoryURLGenerator urlster = getItemURLGenerator(row, column);
if (urlster != null) {
url = urlster.generateURL(dataset, row, column);
}
CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
entities.add(entity);
}
Aggregations