sclass TickerGraphPainter extends AbstractTickerPainter is IToolTipMaker, MakesBufferedImage { settable S pricePrefix = "Price="; public void drawOn(Graphics2D g) { if (verticalRange == null) verticalRange(verticalRangeForTicker(ticker)); if (horizontalRange == null) horizontalRange(horizontalRangeForTicker(ticker)); if (horizontalRange == null) ret; drawPercentLines(g); drawAdditionalObjects(g); // Draw ticker graph var xRange = roundToIntRange(xRange()); int idx1, idx2 = ticker.indexOfTimestamp(xFromScreen(xRange.start)); for (int x = xRange.start; x < xRange.end; x++) { idx1 = idx2; idx2 = ticker.indexOfTimestamp(xFromScreen(x+1)); var seq = ticker.subSequence(idx1, idx2+1); int y1 = iround(yToScreen(seq.maxPrice())); int y2 = iround(yToScreen(seq.minPrice())); drawLine(g, x, y1, x, y2, Color.white); } drawPositions(g); } public BufferedImage render() { var img = super.render(); var img2 = cloneBufferedImageWithMeta(img); metaSet(img2, IToolTipMaker, this); ret img2; } public S getToolTip(Pt p) { double time = xFromScreen(p.x); double price = ticker.priceAtTimestamp(time); ret spaceCombine( ticker.market, formatPrice(price), "at", formatLocalDateWithSeconds(lround(time))); } swappable S formatPrice(double price) { ret pricePrefix() + formatDouble3X(price); } }