/** * Generates a tool tip text item for a particular item within a series. * * @param data the dataset. * @param series the series number (zero-based index). * @param item the item number (zero-based index). * * @return The tool tip text (possibly <code>null</code>). */ public String generateToolTip(XYDataset data, int series, int item) { String xStr, yStr; if (data instanceof YisSymbolic) { yStr = ((YisSymbolic) data).getYSymbolicValue(series, item); } else { double y = data.getYValue(series, item); yStr = Double.toString(round(y, 2)); } if (data instanceof XisSymbolic) { xStr = ((XisSymbolic) data).getXSymbolicValue(series, item); } else if (data instanceof TimeSeriesCollection) { RegularTimePeriod p = ((TimeSeriesCollection) data).getSeries(series) .getTimePeriod(item); xStr = p.toString(); } else { double x = data.getXValue(series, item); xStr = Double.toString(round(x, 2)); } return "X: " + xStr + ", Y: " + yStr; }
/** * Generates a tool tip text item for a particular item within a series. * * @param data the dataset. * @param series the series number (zero-based index). * @param item the item number (zero-based index). * * @return The tool tip text (possibly <code>null</code>). */ @Override public String generateToolTip(XYDataset data, int series, int item) { String xStr, yStr; if (data instanceof YisSymbolic) { yStr = ((YisSymbolic) data).getYSymbolicValue(series, item); } else { double y = data.getYValue(series, item); yStr = Double.toString(round(y, 2)); } if (data instanceof XisSymbolic) { xStr = ((XisSymbolic) data).getXSymbolicValue(series, item); } else if (data instanceof TimeSeriesCollection) { RegularTimePeriod p = ((TimeSeriesCollection) data).getSeries(series) .getTimePeriod(item); xStr = p.toString(); } else { double x = data.getXValue(series, item); xStr = Double.toString(round(x, 2)); } return "X: " + xStr + ", Y: " + yStr; }
/** * Generates a tool tip text item for a particular item within a series. * * @param data the dataset. * @param series the series number (zero-based index). * @param item the item number (zero-based index). * * @return The tool tip text (possibly {@code null}). */ @Override public String generateToolTip(XYDataset data, int series, int item) { String xStr, yStr; if (data instanceof YisSymbolic) { yStr = ((YisSymbolic) data).getYSymbolicValue(series, item); } else { double y = data.getYValue(series, item); yStr = Double.toString(round(y, 2)); } if (data instanceof XisSymbolic) { xStr = ((XisSymbolic) data).getXSymbolicValue(series, item); } else if (data instanceof TimeSeriesCollection) { RegularTimePeriod p = ((TimeSeriesCollection) data).getSeries(series) .getTimePeriod(item); xStr = p.toString(); } else { double x = data.getXValue(series, item); xStr = Double.toString(round(x, 2)); } return "X: " + xStr + ", Y: " + yStr; }