Scatter plot with x-axis having String labels

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
juhi
Posts: 15
Joined: Wed Jul 14, 2004 7:19 pm

Scatter plot with x-axis having String labels

Post by juhi » Fri Jul 30, 2004 2:15 am

Hi,
Is it possible to have a scatter plot with x-axis showing string labels and y-axis as numeric data? For eg;, if i want a scatter plot for the following data -

X,Y
----
A,1
A,2
B,4
B,3
B,5
C,6
C,9

I think the TableXYDataset does something like having the same x-values right?

thanks,
Juhi

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jul 30, 2004 8:53 am

Try out SymbolicChartDemo1 and SymbolicXYPlotDemo1.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

juhi
Posts: 15
Joined: Wed Jul 14, 2004 7:19 pm

Post by juhi » Fri Jul 30, 2004 5:48 pm

Hi David,

Thanks for replying! I checked out those charts. It looks like the x-values are the actual data that needs to be plotted, and y-values are like 0,1,2,etc. based on the number of items (or symbols in my case) need to be plotted. Is that right?

Also wanted to know that if my symbol names are huge and i'm plotting a large number of these items on the y-axis the labelling will get all screwed up (even if I try the positioning stuff - UP_45 and setting the width to 0.5f). so is there some way by which if I specify something like an alias to each of these items and have a legend below that shows each item corresponding to that alias? For eg., my y-axis will have labels like a,b,c,d... and a legend below the plot that shows this-
a = "nameAwhichwasveryhugethatitcouldnotfit"
b = "nameBwhichwasveryhugethatitcouldnotfit"
c = "nameCwhichwasveryhugethatitcouldnotfit"
d = "nameDwhichwasveryhugethatitcouldnotfit"
...

I checked out the legend related classes from the documentation as well as the actual code, but could not understand how I could do something like this. Its really important that I do something like this. So, can you please give me some pointers in this direction? I will highly appreciate your time and help with this.

Thanks,
Juhi.

PS: question open to everyone - can anyone please give me a solution for the legend stuff?

Locked