Page 1 of 1

addAnnotation(pointer) doesn't work for CandlestickChart

Posted: Wed Feb 13, 2008 3:46 pm
by kafka
Hi,
is it true, that addAnnotation doesn't work for CandlestickChart? If yes, what can I use as an alternative?
COde:

Code: Select all

JFreeChart chart = ChartFactory.createCandlestickChart("TradeGraph", "day", "value", highLowDataset, true);

XYPlot xy = chart.getXYPlot();

XYPointerAnnotation pointer2 = new XYPointerAnnotation(
        		"Best Bid", 10, 163.0, 3.0 * Math.PI / 4.0
        		);
        pointer2.setTipRadius(1.0);
        pointer2.setBaseRadius(750.0);
        pointer2.setFont(new Font("SansSerif", Font.PLAIN, 9));
        pointer2.setPaint(Color.blue);
        pointer2.setTextAnchor(TextAnchor.HALF_ASCENT_RIGHT);
        xy.addAnnotation(pointer2);

thank you.

Posted: Sun Apr 06, 2008 2:55 pm
by skunk
I suspect that the annotation is actually being displayed, just not where it should be. The second argument (10) looks suspicious, unless you actually have a data point 10 milliseconds after 01 Jan 1970 UTC.