Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 How do I get a legend to show colors?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
javaman Posted - 20 Oct 2008 : 13:04:50
I have a plot which has multiple lines on it. Each line has a different color - I'd like the legend to show which line is which by using the color indicated in the plot. Is this possible?

Also, where are the javadocs?

Thanx - Joe!
3   L A T E S T    R E P L I E S    (Newest First)
quinncurtis Posted - 30 Oct 2008 : 20:27:00
We tested the Legends with a group plot and it worked fine for us. If you are passing in a group plot object, you do have to use the AddLegendItem method that specifies a group number, though, numbers 0, 1, 2, and 3 below.

legend.addLegendItem("Prozac", ChartConstants.HBAR, thePlot2, 0, legendFont);
legend.addLegendItem("Zoloft", ChartConstants.HBAR, thePlot2, 1, legendFont);
legend.addLegendItem("Paxil", ChartConstants.HBAR, thePlot2, 2, legendFont);
legend.addLegendItem("Celexa", ChartConstants.HBAR, thePlot2, 3, legendFont);


Or you can just use the addLegendItem overloads where you explicitly set the color attribute, rather than use a lookup of the plot objects color attribute. They all seem to work.

If you can't figure it out show the code you used creating the legend with the MultiLinePlot.
javaman Posted - 30 Oct 2008 : 20:01:56
Thanks for the response. It turns out that the multiline plot is the cause of the "no colors" in the legend. Once I switched to multiple SimpleLinePlots the colors in the legends appeared. You may want to file a bug on this to your developers.

thanx. Joe...

Thanx - Joe!
quinncurtis Posted - 20 Oct 2008 : 13:13:45
The example program SimpleLinePlots has several examples of creating legends for line plots. Are you saying that these example do not display the legend items in color?

The Javadoc for the library is found in the QCChart2DJava.jar library file, located in the Quinn-Curtis\java\lib folder, as described in Chapter 23 of the manual "Compiling and Running the Example Programs".

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07