Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 How do I get a legend to show colors?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

javaman

22 Posts

Posted - 20 Oct 2008 :  13:04:50  Show Profile  Reply with Quote
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!

quinncurtis

1164 Posts

Posted - 20 Oct 2008 :  13:13:45  Show Profile  Reply with Quote
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".
Go to Top of Page

javaman

22 Posts

Posted - 30 Oct 2008 :  20:01:56  Show Profile  Reply with Quote
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!
Go to Top of Page

quinncurtis

1164 Posts

Posted - 30 Oct 2008 :  20:27:00  Show Profile  Reply with Quote
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07