addAnnotation(pointer) doesn't work for CandlestickChart

Discussion about JFreeChart related to stockmarket charts.
Locked
kafka
Posts: 1
Joined: Wed Feb 13, 2008 3:40 pm

addAnnotation(pointer) doesn't work for CandlestickChart

Post by kafka » Wed Feb 13, 2008 3:46 pm

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.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Sun Apr 06, 2008 2:55 pm

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.

Locked