@Override public double[] getValues(ChartFrame cf, int i) { Dataset stoD = visibleDataset(cf, properties.getSF() ? FASTD : SLOWD); Dataset stoK = visibleDataset(cf, properties.getSF() ? FASTK : SLOWK); if (stoD != null && stoK != null) return new double[] {stoD.getCloseAt(i), stoK.getCloseAt(i)}; return new double[] {}; }
@Override public void paint(Graphics2D g, ChartFrame cf, Rectangle bounds) { Dataset stoD = visibleDataset(cf, properties.getSF() ? FASTD : SLOWD); Dataset stoK = visibleDataset(cf, properties.getSF() ? FASTK : SLOWK); if (stoD != null && stoK != null) { if (maximized) { Range range = getRange(cf); DefaultPainter.line( g, cf, range, bounds, stoD, properties.getColorD(), properties.getStrokeD()); DefaultPainter.line( g, cf, range, bounds, stoK, properties.getColorK(), properties.getStrokeK()); } } }
@Override public LinkedHashMap getHTML(ChartFrame cf, int i) { LinkedHashMap ht = new LinkedHashMap(); DecimalFormat df = new DecimalFormat("#,##0.00"); double[] values = getValues(cf, i); String[] labels = {"%D:", "%K:"}; ht.put((properties.getSF() ? "Fast" : "Slow") + getLabel(), " "); if (values.length > 0) { Color[] colors = getColors(); for (int j = 0; j < values.length; j++) { ht.put(getFontHTML(colors[j], labels[j]), getFontHTML(colors[j], df.format(values[j]))); } } return ht; }
@Override public String getPaintedLabel(ChartFrame cf) { return (properties.getSF() ? "Fast" : "Slow") + getLabel(); }