1 28 package net.sf.jasperreports.renderers; 29 30 import java.util.Map ; 31 32 import net.sf.jasperreports.engine.JRConstants; 33 import net.sf.jasperreports.engine.JRPrintHyperlink; 34 35 import org.jfree.chart.JFreeChart; 36 import org.jfree.chart.entity.ChartEntity; 37 import org.jfree.chart.entity.XYItemEntity; 38 import org.jfree.data.time.RegularTimePeriod; 39 import org.jfree.data.time.TimeSeries; 40 import org.jfree.data.time.TimeSeriesCollection; 41 42 43 49 public class JRTimeSeriesChartImageMapRenderer extends JRAbstractChartImageMapRenderer 50 { 51 52 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 53 54 private Map itemHyperlinks; 55 56 public JRTimeSeriesChartImageMapRenderer(JFreeChart chart, Map itemHyperlinks) 57 { 58 super(chart); 59 60 this.itemHyperlinks = itemHyperlinks; 61 } 62 63 64 protected JRPrintHyperlink getEntityHyperlink(ChartEntity entity) 65 { 66 JRPrintHyperlink printHyperlink = null; 67 if (entity instanceof XYItemEntity) 68 { 69 XYItemEntity itemEntity = (XYItemEntity) entity; 70 TimeSeriesCollection dataset = (TimeSeriesCollection) itemEntity.getDataset(); 71 TimeSeries series = dataset.getSeries(itemEntity.getSeriesIndex()); 72 Map serieHyperlinks = (Map ) itemHyperlinks.get(series.getKey()); 73 if (serieHyperlinks != null) 74 { 75 RegularTimePeriod timePeriod = series.getTimePeriod(itemEntity.getItem()); 76 printHyperlink = (JRPrintHyperlink) serieHyperlinks.get(timePeriod); 77 } 78 } 79 return printHyperlink; 80 } 81 82 } 83 | Popular Tags |