I have three time series that I’m plotting, and I would like to use the numbers 1, 3, and 5 as the actual shapes that the XYLineAndShapeRenderer use to display the series.
Even if you have no experience using JFreeChart, if I could figure out how to do any of the following, I think I could accomplish my task:
- Convert a character / glyph to a java.awt.Shape
- Convert a character / glyph to an ImageIcon
You can obtain glyph outlines using
Font.createGlyphVectorandGlyphVector.getGlyphOutline.The method below retrieves a
GlyphVectorfor the specifiedStringand retrieves their outlines, applying anAffineTransformin the process.By default the returned glyph shapes are of font size 1, hence the
AffineTransform. An example transform would be:Which should roughly center each glyph (which I presume you’ll need) at a font-size of 40. For more accurate centering, you could use
GlyphMetrics, obtained throughGlyphVector.getGlyphMetricand calculate the exact translation you need.