Using a String to represent points instead of a Shape

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
stu
Posts: 10
Joined: Mon Aug 01, 2005 1:44 pm

Using a String to represent points instead of a Shape

Post by stu » Wed Nov 14, 2007 3:18 pm

I have a slightly unusual requirement where I want to specifiy that a renderer uses a String for plotting XY points.

For example, there are some useful unicode characters like the Male and Female symbols which are easy to represent as a String:

Code: Select all

new Character('\u2642').toString()
This String can then be used by the Graphics2D.drawString() method to plot the point. The alternative of converting the String to a Shape that can be used by the renderer's setSeriesShape(Shape shape) method seems overly complicated.

Can anyone give me some pointers on how to achieve this in JFreeChart? Is it the kind of feature that would be useful to others? I'm thinking like a renderer.setSeriesCharacter(Character c) method?

Locked