1 41 42 package org.jfree.chart.labels; 43 44 import java.io.Serializable ; 45 import java.text.DateFormat ; 46 import java.text.NumberFormat ; 47 48 import org.jfree.data.xy.XYDataset; 49 import org.jfree.util.PublicCloneable; 50 51 55 public class StandardXYToolTipGenerator extends AbstractXYItemLabelGenerator 56 implements XYToolTipGenerator, 57 Cloneable , 58 PublicCloneable, 59 Serializable { 60 61 62 private static final long serialVersionUID = -3564164459039540784L; 63 64 65 public static final String DEFAULT_TOOL_TIP_FORMAT = "{0}: ({1}, {2})"; 66 67 73 public static StandardXYToolTipGenerator getTimeSeriesInstance() { 74 return new StandardXYToolTipGenerator( 75 DEFAULT_TOOL_TIP_FORMAT, DateFormat.getInstance(), 76 NumberFormat.getInstance() 77 ); 78 } 79 80 83 public StandardXYToolTipGenerator() { 84 this( 85 DEFAULT_TOOL_TIP_FORMAT, 86 NumberFormat.getNumberInstance(), NumberFormat.getNumberInstance() 87 ); 88 } 89 90 100 public StandardXYToolTipGenerator(String formatString, 101 NumberFormat xFormat, 102 NumberFormat yFormat) { 103 104 super(formatString, xFormat, yFormat); 105 106 } 107 108 118 public StandardXYToolTipGenerator(String formatString, 119 DateFormat xFormat, 120 NumberFormat yFormat) { 121 122 super(formatString, xFormat, yFormat); 123 124 } 125 126 136 public StandardXYToolTipGenerator(String formatString, 137 DateFormat xFormat, 138 DateFormat yFormat) { 139 140 super(formatString, xFormat, yFormat); 141 142 } 143 144 153 public String generateToolTip(XYDataset dataset, int series, int item) { 154 return generateLabelString(dataset, series, item); 155 } 156 157 164 public boolean equals(Object obj) { 165 if (obj == this) { 166 return true; 167 } 168 if (obj instanceof StandardXYToolTipGenerator) { 169 return super.equals(obj); 170 } 171 return false; 172 } 173 174 181 public Object clone() throws CloneNotSupportedException { 182 return super.clone(); 183 } 184 185 } 186 | Popular Tags |