I seem to be having problems with test annotations in JFreeChart XYPlot. I can set the text annotation as follows
XYTextAnnotation textAnnotaion = new XYTextAnnotation(description, xMid, yMid); plot.addAnnotation(textAnnotaion);
I can also rotate the text by adding
textAnnotaion.setRotationAngle(90.0);
But if I try to change the font type / size or color, it does not work
textAnnotaion.setFont(new Font("Tahoma", Font.BOLD, 20)); textAnnotaion.setPaint(new Color(255, 255, 255, 15));
The font remains black and has a default type / size. Oddly enough, the functionality seems fine on the candlestick chart, but not the simple vanilla XYPlot
Has anyone else experienced this or am I doing something wrong?
========
I think I figured it out. In my code for a candlestick chart, a dataset is added to the chart at build time. It seems that adding text annotations works correctly. In the case of my XYPlot, I create a chart with an empty XYSeriesCollection and, subsequently, add a series of data on the fly.
If I add text annotation and then set the frame to visible, the font changes (color and type) will not be applied. If I set the border visible and then apply the annotation, everything will look fine. It starts to look like an error ....
=======